diff options
Diffstat (limited to 'docs/feature_rgb_matrix.md')
| -rw-r--r-- | docs/feature_rgb_matrix.md | 141 |
1 files changed, 113 insertions, 28 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 08d5c9c4c..f3e25f2f1 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
| @@ -145,9 +145,22 @@ There is basic support for addressable RGB matrix lighting with the I2C IS31FL37 | |||
| 145 | RGB_MATRIX_ENABLE = yes | 145 | RGB_MATRIX_ENABLE = yes |
| 146 | RGB_MATRIX_DRIVER = IS31FL3737 | 146 | RGB_MATRIX_DRIVER = IS31FL3737 |
| 147 | ``` | 147 | ``` |
| 148 | You can use between 1 and 2 IS31FL3737 IC's. Do not specify `DRIVER_ADDR_2` define for second IC if not present on your keyboard. | ||
| 148 | 149 | ||
| 149 | Configure the hardware via your `config.h`: | 150 | Configure the hardware via your `config.h`: |
| 150 | 151 | ||
| 152 | | Variable | Description | Default | | ||
| 153 | |----------|-------------|---------| | ||
| 154 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | ||
| 155 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | ||
| 156 | | `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | ||
| 157 | | `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | | | ||
| 158 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | | ||
| 159 | | `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | | | ||
| 160 | |||
| 161 | |||
| 162 | Here is an example using 2 drivers. | ||
| 163 | |||
| 151 | ```c | 164 | ```c |
| 152 | // This is a 7-bit address, that gets left-shifted and bit 0 | 165 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 153 | // set to 0 for write, 1 for read (as per I2C protocol) | 166 | // set to 0 for write, 1 for read (as per I2C protocol) |
| @@ -159,19 +172,21 @@ Configure the hardware via your `config.h`: | |||
| 159 | // ADDR represents A3:A0 of the 7-bit address. | 172 | // ADDR represents A3:A0 of the 7-bit address. |
| 160 | // The result is: 0b101(ADDR) | 173 | // The result is: 0b101(ADDR) |
| 161 | #define DRIVER_ADDR_1 0b1010000 | 174 | #define DRIVER_ADDR_1 0b1010000 |
| 162 | #define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons. | 175 | #define DRIVER_ADDR_2 0b1010001 |
| 163 | 176 | ||
| 164 | #define DRIVER_COUNT 2 | 177 | #define DRIVER_COUNT 2 |
| 165 | #define DRIVER_1_LED_TOTAL 64 | 178 | #define DRIVER_1_LED_TOTAL 30 |
| 166 | #define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL | 179 | #define DRIVER_2_LED_TOTAL 36 |
| 180 | #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | ||
| 167 | ``` | 181 | ``` |
| 182 | !> 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`. | ||
| 168 | 183 | ||
| 169 | Currently only a single drivers is supported, but it would be trivial to support all 4 combinations. For now define `DRIVER_ADDR_2` as `DRIVER_ADDR_1` | 184 | Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations. |
| 170 | 185 | ||
| 171 | Define these arrays listing all the LEDs in your `<keyboard>.c`: | 186 | Define these arrays listing all the LEDs in your `<keyboard>.c`: |
| 172 | 187 | ||
| 173 | ```c | 188 | ```c |
| 174 | const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | 189 | const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { |
| 175 | /* Refer to IS31 manual for these locations | 190 | /* Refer to IS31 manual for these locations |
| 176 | * driver | 191 | * driver |
| 177 | * | R location | 192 | * | R location |
| @@ -183,7 +198,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | |||
| 183 | } | 198 | } |
| 184 | ``` | 199 | ``` |
| 185 | 200 | ||
| 186 | Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0` right now). | 201 | Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0`, `1` for now). |
| 187 | 202 | ||
| 188 | --- | 203 | --- |
| 189 | 204 | ||
| @@ -228,6 +243,75 @@ Configure the hardware via your `config.h`: | |||
| 228 | ``` | 243 | ``` |
| 229 | 244 | ||
| 230 | --- | 245 | --- |
| 246 | ### AW20216 :id=aw20216 | ||
| 247 | There is basic support for addressable RGB matrix lighting with the SPI AW20216 RGB controller. To enable it, add this to your `rules.mk`: | ||
| 248 | |||
| 249 | ```makefile | ||
| 250 | RGB_MATRIX_ENABLE = yes | ||
| 251 | RGB_MATRIX_DRIVER = AW20216 | ||
| 252 | ``` | ||
| 253 | |||
| 254 | You 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`: | ||
| 255 | |||
| 256 | | Variable | Description | Default | | ||
| 257 | |----------|-------------|---------| | ||
| 258 | | `DRIVER_1_CS` | (Required) MCU pin connected to first RGB driver chip select line | B13 | | ||
| 259 | | `DRIVER_2_CS` | (Optional) MCU pin connected to second RGB driver chip select line | | | ||
| 260 | | `DRIVER_1_EN` | (Required) MCU pin connected to first RGB driver hardware enable line | C13 | | ||
| 261 | | `DRIVER_2_EN` | (Optional) MCU pin connected to second RGB driver hardware enable line | | | ||
| 262 | | `DRIVER_1_LED_TOTAL` | (Required) How many RGB lights are connected to first RGB driver | | | ||
| 263 | | `DRIVER_2_LED_TOTAL` | (Optional) How many RGB lights are connected to second RGB driver | | | ||
| 264 | | `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | ||
| 265 | | `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | | | ||
| 266 | | `AW_SCALING_MAX` | (Optional) LED current scaling value (0-255, higher values mean LED is brighter at full PWM) | 150 | | ||
| 267 | | `AW_GLOBAL_CURRENT_MAX` | (Optional) Driver global current limit (0-255, higher values means the driver may consume more power) | 150 | | ||
| 268 | | `AW_SPI_DIVISOR` | (Optional) Clock divisor for SPI communication (powers of 2, smaller numbers means faster communication, should not be less than 4) | 4 | | ||
| 269 | |||
| 270 | Here is an example using 2 drivers. | ||
| 271 | |||
| 272 | ```c | ||
| 273 | #define DRIVER_1_CS B13 | ||
| 274 | #define DRIVER_2_CS B14 | ||
| 275 | // Hardware enable lines may be connected to the same pin | ||
| 276 | #define DRIVER_1_EN C13 | ||
| 277 | #define DRIVER_2_EN C13 | ||
| 278 | |||
| 279 | #define DRIVER_COUNT 2 | ||
| 280 | #define DRIVER_1_LED_TOTAL 66 | ||
| 281 | #define DRIVER_2_LED_TOTAL 32 | ||
| 282 | #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | ||
| 283 | ``` | ||
| 284 | |||
| 285 | !> 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`. | ||
| 286 | |||
| 287 | Define these arrays listing all the LEDs in your `<keyboard>.c`: | ||
| 288 | |||
| 289 | ```c | ||
| 290 | const aw_led g_aw_leds[DRIVER_LED_TOTAL] = { | ||
| 291 | /* Each AW20216 channel is controlled by a register at some offset between 0x00 | ||
| 292 | * and 0xD7 inclusive. | ||
| 293 | * See drivers/awinic/aw20216.h for the mapping between register offsets and | ||
| 294 | * driver pin locations. | ||
| 295 | * driver | ||
| 296 | * | R location | ||
| 297 | * | | G location | ||
| 298 | * | | | B location | ||
| 299 | * | | | | */ | ||
| 300 | { 0, CS1_SW1, CS2_SW1, CS3_SW1 }, | ||
| 301 | { 0, CS4_SW1, CS5_SW1, CS6_SW1 }, | ||
| 302 | { 0, CS7_SW1, CS8_SW1, CS9_SW1 }, | ||
| 303 | { 0, CS10_SW1, CS11_SW1, CS12_SW1 }, | ||
| 304 | { 0, CS13_SW1, CS14_SW1, CS15_SW1 }, | ||
| 305 | ... | ||
| 306 | { 1, CS1_SW1, CS2_SW1, CS3_SW1 }, | ||
| 307 | { 1, CS13_SW1, CS14_SW1, CS15_SW1 }, | ||
| 308 | { 1, CS16_SW1, CS17_SW1, CS18_SW1 }, | ||
| 309 | { 1, CS4_SW2, CS5_SW2, CS6_SW2 }, | ||
| 310 | ... | ||
| 311 | }; | ||
| 312 | ``` | ||
| 313 | |||
| 314 | --- | ||
| 231 | 315 | ||
| 232 | ## Common Configuration :id=common-configuration | 316 | ## Common Configuration :id=common-configuration |
| 233 | 317 | ||
| @@ -485,28 +569,29 @@ For inspiration and examples, check out the built-in effects under `quantum/rgb_ | |||
| 485 | 569 | ||
| 486 | These are shorthands to popular colors. The `RGB` ones can be passed to the `setrgb` functions, while the `HSV` ones to the `sethsv` functions. | 570 | These are shorthands to popular colors. The `RGB` ones can be passed to the `setrgb` functions, while the `HSV` ones to the `sethsv` functions. |
| 487 | 571 | ||
| 488 | |RGB |HSV | | 572 | |RGB |HSV | |
| 489 | |-------------------|-------------------| | 573 | |---------------------|---------------------| |
| 490 | |`RGB_WHITE` |`HSV_WHITE` | | 574 | |`RGB_AZURE` |`HSV_AZURE` | |
| 491 | |`RGB_RED` |`HSV_RED` | | 575 | |`RGB_BLACK`/`RGB_OFF`|`HSV_BLACK`/`HSV_OFF`| |
| 492 | |`RGB_CORAL` |`HSV_CORAL` | | 576 | |`RGB_BLUE` |`HSV_BLUE` | |
| 493 | |`RGB_ORANGE` |`HSV_ORANGE` | | 577 | |`RGB_CHARTREUSE` |`HSV_CHARTREUSE` | |
| 494 | |`RGB_GOLDENROD` |`HSV_GOLDENROD` | | 578 | |`RGB_CORAL` |`HSV_CORAL` | |
| 495 | |`RGB_GOLD` |`HSV_GOLD` | | 579 | |`RGB_CYAN` |`HSV_CYAN` | |
| 496 | |`RGB_YELLOW` |`HSV_YELLOW` | | 580 | |`RGB_GOLD` |`HSV_GOLD` | |
| 497 | |`RGB_CHARTREUSE` |`HSV_CHARTREUSE` | | 581 | |`RGB_GOLDENROD` |`HSV_GOLDENROD` | |
| 498 | |`RGB_GREEN` |`HSV_GREEN` | | 582 | |`RGB_GREEN` |`HSV_GREEN` | |
| 499 | |`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` | | 583 | |`RGB_MAGENTA` |`HSV_MAGENTA` | |
| 500 | |`RGB_TURQUOISE` |`HSV_TURQUOISE` | | 584 | |`RGB_ORANGE` |`HSV_ORANGE` | |
| 501 | |`RGB_TEAL` |`HSV_TEAL` | | 585 | |`RGB_PINK` |`HSV_PINK` | |
| 502 | |`RGB_CYAN` |`HSV_CYAN` | | 586 | |`RGB_PURPLE` |`HSV_PURPLE` | |
| 503 | |`RGB_AZURE` |`HSV_AZURE` | | 587 | |`RGB_RED` |`HSV_RED` | |
| 504 | |`RGB_BLUE` |`HSV_BLUE` | | 588 | |`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` | |
| 505 | |`RGB_PURPLE` |`HSV_PURPLE` | | 589 | |`RGB_TEAL` |`HSV_TEAL` | |
| 506 | |`RGB_MAGENTA` |`HSV_MAGENTA` | | 590 | |`RGB_TURQUOISE` |`HSV_TURQUOISE` | |
| 507 | |`RGB_PINK` |`HSV_PINK` | | 591 | |`RGB_WHITE` |`HSV_WHITE` | |
| 508 | 592 | |`RGB_YELLOW` |`HSV_YELLOW` | | |
| 509 | These 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! | 593 | |
| 594 | These are defined in [`color.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/color.h). Feel free to add to this list! | ||
| 510 | 595 | ||
| 511 | 596 | ||
| 512 | ## Additional `config.h` Options :id=additional-configh-options | 597 | ## Additional `config.h` Options :id=additional-configh-options |
