aboutsummaryrefslogtreecommitdiff
path: root/docs/feature_rgb_matrix.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/feature_rgb_matrix.md')
-rw-r--r--docs/feature_rgb_matrix.md114
1 files changed, 92 insertions, 22 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 08d5c9c4c..675b7a1be 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -228,6 +228,75 @@ Configure the hardware via your `config.h`:
228``` 228```
229 229
230--- 230---
231### AW20216 :id=aw20216
232There is basic support for addressable RGB matrix lighting with the SPI AW20216 RGB controller. To enable it, add this to your `rules.mk`:
233
234```makefile
235RGB_MATRIX_ENABLE = yes
236RGB_MATRIX_DRIVER = AW20216
237```
238
239You can use up to 2 AW20216 IC's. Do not specify `DRIVER_<N>_xxx` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
240
241| Variable | Description | Default |
242|----------|-------------|---------|
243| `DRIVER_1_CS` | (Required) MCU pin connected to first RGB driver chip select line | B13 |
244| `DRIVER_2_CS` | (Optional) MCU pin connected to second RGB driver chip select line | |
245| `DRIVER_1_EN` | (Required) MCU pin connected to first RGB driver hardware enable line | C13 |
246| `DRIVER_2_EN` | (Optional) MCU pin connected to second RGB driver hardware enable line | |
247| `DRIVER_1_LED_TOTAL` | (Required) How many RGB lights are connected to first RGB driver | |
248| `DRIVER_2_LED_TOTAL` | (Optional) How many RGB lights are connected to second RGB driver | |
249| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
250| `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | |
251| `AW_SCALING_MAX` | (Optional) LED current scaling value (0-255, higher values mean LED is brighter at full PWM) | 150 |
252| `AW_GLOBAL_CURRENT_MAX` | (Optional) Driver global current limit (0-255, higher values means the driver may consume more power) | 150 |
253| `AW_SPI_DIVISOR` | (Optional) Clock divisor for SPI communication (powers of 2, smaller numbers means faster communication, should not be less than 4) | 4 |
254
255Here is an example using 2 drivers.
256
257```c
258#define DRIVER_1_CS B13
259#define DRIVER_2_CS B14
260// Hardware enable lines may be connected to the same pin
261#define DRIVER_1_EN C13
262#define DRIVER_2_EN C13
263
264#define DRIVER_COUNT 2
265#define DRIVER_1_LED_TOTAL 66
266#define DRIVER_2_LED_TOTAL 32
267#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
268```
269
270!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
271
272Define these arrays listing all the LEDs in your `<keyboard>.c`:
273
274```c
275const aw_led g_aw_leds[DRIVER_LED_TOTAL] = {
276/* Each AW20216 channel is controlled by a register at some offset between 0x00
277 * and 0xD7 inclusive.
278 * See drivers/awinic/aw20216.h for the mapping between register offsets and
279 * driver pin locations.
280 * driver
281 * | R location
282 * | | G location
283 * | | | B location
284 * | | | | */
285 { 0, CS1_SW1, CS2_SW1, CS3_SW1 },
286 { 0, CS4_SW1, CS5_SW1, CS6_SW1 },
287 { 0, CS7_SW1, CS8_SW1, CS9_SW1 },
288 { 0, CS10_SW1, CS11_SW1, CS12_SW1 },
289 { 0, CS13_SW1, CS14_SW1, CS15_SW1 },
290 ...
291 { 1, CS1_SW1, CS2_SW1, CS3_SW1 },
292 { 1, CS13_SW1, CS14_SW1, CS15_SW1 },
293 { 1, CS16_SW1, CS17_SW1, CS18_SW1 },
294 { 1, CS4_SW2, CS5_SW2, CS6_SW2 },
295 ...
296};
297```
298
299---
231 300
232## Common Configuration :id=common-configuration 301## Common Configuration :id=common-configuration
233 302
@@ -485,28 +554,29 @@ For inspiration and examples, check out the built-in effects under `quantum/rgb_
485 554
486These are shorthands to popular colors. The `RGB` ones can be passed to the `setrgb` functions, while the `HSV` ones to the `sethsv` functions. 555These are shorthands to popular colors. The `RGB` ones can be passed to the `setrgb` functions, while the `HSV` ones to the `sethsv` functions.
487 556
488|RGB |HSV | 557|RGB |HSV |
489|-------------------|-------------------| 558|---------------------|---------------------|
490|`RGB_WHITE` |`HSV_WHITE` | 559|`RGB_AZURE` |`HSV_AZURE` |
491|`RGB_RED` |`HSV_RED` | 560|`RGB_BLACK`/`RGB_OFF`|`HSV_BLACK`/`HSV_OFF`|
492|`RGB_CORAL` |`HSV_CORAL` | 561|`RGB_BLUE` |`HSV_BLUE` |
493|`RGB_ORANGE` |`HSV_ORANGE` | 562|`RGB_CHARTREUSE` |`HSV_CHARTREUSE` |
494|`RGB_GOLDENROD` |`HSV_GOLDENROD` | 563|`RGB_CORAL` |`HSV_CORAL` |
495|`RGB_GOLD` |`HSV_GOLD` | 564|`RGB_CYAN` |`HSV_CYAN` |
496|`RGB_YELLOW` |`HSV_YELLOW` | 565|`RGB_GOLD` |`HSV_GOLD` |
497|`RGB_CHARTREUSE` |`HSV_CHARTREUSE` | 566|`RGB_GOLDENROD` |`HSV_GOLDENROD` |
498|`RGB_GREEN` |`HSV_GREEN` | 567|`RGB_GREEN` |`HSV_GREEN` |
499|`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` | 568|`RGB_MAGENTA` |`HSV_MAGENTA` |
500|`RGB_TURQUOISE` |`HSV_TURQUOISE` | 569|`RGB_ORANGE` |`HSV_ORANGE` |
501|`RGB_TEAL` |`HSV_TEAL` | 570|`RGB_PINK` |`HSV_PINK` |
502|`RGB_CYAN` |`HSV_CYAN` | 571|`RGB_PURPLE` |`HSV_PURPLE` |
503|`RGB_AZURE` |`HSV_AZURE` | 572|`RGB_RED` |`HSV_RED` |
504|`RGB_BLUE` |`HSV_BLUE` | 573|`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` |
505|`RGB_PURPLE` |`HSV_PURPLE` | 574|`RGB_TEAL` |`HSV_TEAL` |
506|`RGB_MAGENTA` |`HSV_MAGENTA` | 575|`RGB_TURQUOISE` |`HSV_TURQUOISE` |
507|`RGB_PINK` |`HSV_PINK` | 576|`RGB_WHITE` |`HSV_WHITE` |
508 577|`RGB_YELLOW` |`HSV_YELLOW` |
509These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h). Feel free to add to this list! 578
579These are defined in [`color.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/color.h). Feel free to add to this list!
510 580
511 581
512## Additional `config.h` Options :id=additional-configh-options 582## Additional `config.h` Options :id=additional-configh-options