diff options
Diffstat (limited to 'docs/feature_rgb_matrix.md')
-rw-r--r-- | docs/feature_rgb_matrix.md | 73 |
1 files changed, 54 insertions, 19 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 2dbd32fbd..6370c637a 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
@@ -10,7 +10,7 @@ If you want to use single color LED's you should use the [LED Matrix Subsystem]( | |||
10 | 10 | ||
11 | There is basic support for addressable RGB matrix lighting with the I2C IS31FL3731 RGB controller. To enable it, add this to your `rules.mk`: | 11 | There is basic support for addressable RGB matrix lighting with the I2C IS31FL3731 RGB controller. To enable it, add this to your `rules.mk`: |
12 | 12 | ||
13 | ```makefile | 13 | ```make |
14 | RGB_MATRIX_ENABLE = yes | 14 | RGB_MATRIX_ENABLE = yes |
15 | RGB_MATRIX_DRIVER = IS31FL3731 | 15 | RGB_MATRIX_DRIVER = IS31FL3731 |
16 | ``` | 16 | ``` |
@@ -21,6 +21,7 @@ You can use between 1 and 4 IS31FL3731 IC's. Do not specify `DRIVER_ADDR_<N>` de | |||
21 | |----------|-------------|---------| | 21 | |----------|-------------|---------| |
22 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | 22 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | |
23 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | 23 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | |
24 | | `ISSI_3731_DEGHOST` | (Optional) Set this define to enable de-ghosting by halving Vcc during blanking time | | | ||
24 | | `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | 25 | | `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | |
25 | | `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | | | 26 | | `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | | |
26 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | | 27 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | |
@@ -49,6 +50,8 @@ Here is an example using 2 drivers. | |||
49 | 50 | ||
50 | !> 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`. | 51 | !> 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`. |
51 | 52 | ||
53 | For split keyboards using `RGB_MATRIX_SPLIT` with an LED driver, you can either have the same driver address or different driver addresses. If using different addresses, use `DRIVER_ADDR_1` for one and `DRIVER_ADDR_2` for the other one. Then, in `g_is31_leds`, fill out the correct driver index (0 or 1). If using one address, use `DRIVER_ADDR_1` for both, and use index 0 for `g_is31_leds`. | ||
54 | |||
52 | Define these arrays listing all the LEDs in your `<keyboard>.c`: | 55 | Define these arrays listing all the LEDs in your `<keyboard>.c`: |
53 | 56 | ||
54 | ```c | 57 | ```c |
@@ -71,7 +74,7 @@ Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet] | |||
71 | 74 | ||
72 | There is basic support for addressable RGB matrix lighting with the I2C IS31FL3733 RGB controller. To enable it, add this to your `rules.mk`: | 75 | There is basic support for addressable RGB matrix lighting with the I2C IS31FL3733 RGB controller. To enable it, add this to your `rules.mk`: |
73 | 76 | ||
74 | ```makefile | 77 | ```make |
75 | RGB_MATRIX_ENABLE = yes | 78 | RGB_MATRIX_ENABLE = yes |
76 | RGB_MATRIX_DRIVER = IS31FL3733 | 79 | RGB_MATRIX_DRIVER = IS31FL3733 |
77 | ``` | 80 | ``` |
@@ -82,6 +85,9 @@ You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_<N>` de | |||
82 | |----------|-------------|---------| | 85 | |----------|-------------|---------| |
83 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | 86 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | |
84 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | 87 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | |
88 | | `ISSI_PWM_FREQUENCY` | (Optional) PWM Frequency Setting - IS31FL3733B only | 0 | | ||
89 | | `ISSI_SWPULLUP` | (Optional) Set the value of the SWx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | ||
90 | | `ISSI_CSPULLUP` | (Optional) Set the value of the CSx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | ||
85 | | `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | 91 | | `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | |
86 | | `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | | | 92 | | `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | | |
87 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | | 93 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | |
@@ -93,6 +99,18 @@ You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_<N>` de | |||
93 | | `DRIVER_SYNC_3` | (Optional) Sync configuration for the third RGB driver | 0 | | 99 | | `DRIVER_SYNC_3` | (Optional) Sync configuration for the third RGB driver | 0 | |
94 | | `DRIVER_SYNC_4` | (Optional) Sync configuration for the fourth RGB driver | 0 | | 100 | | `DRIVER_SYNC_4` | (Optional) Sync configuration for the fourth RGB driver | 0 | |
95 | 101 | ||
102 | The IS31FL3733 IC's have on-chip resistors that can be enabled to allow for de-ghosting of the RGB matrix. By default these resistors are not enabled (`ISSI_SWPULLUP`/`ISSI_CSPULLUP` are given the value of`PUR_0R`), the values that can be set to enable de-ghosting are as follows: | ||
103 | |||
104 | | `ISSI_SWPULLUP/ISSI_CSPULLUP` | Description | | ||
105 | |----------------------|-------------| | ||
106 | | `PUR_0R` | (default) Do not use the on-chip resistors/enable de-ghosting | | ||
107 | | `PUR_05KR` | The 0.5k Ohm resistor used during blanking period (t_NOL) | | ||
108 | | `PUR_3KR` | The 3k Ohm resistor used at all times | | ||
109 | | `PUR_4KR` | The 4k Ohm resistor used at all times | | ||
110 | | `PUR_8KR` | The 8k Ohm resistor used at all times | | ||
111 | | `PUR_16KR` | The 16k Ohm resistor used at all times | | ||
112 | | `PUR_32KR` | The 32k Ohm resistor used during blanking period (t_NOL) | | ||
113 | |||
96 | Here is an example using 2 drivers. | 114 | Here is an example using 2 drivers. |
97 | 115 | ||
98 | ```c | 116 | ```c |
@@ -141,7 +159,7 @@ Where `X_Y` is the location of the LED in the matrix defined by [the datasheet]( | |||
141 | 159 | ||
142 | There is basic support for addressable RGB matrix lighting with the I2C IS31FL3737 RGB controller. To enable it, add this to your `rules.mk`: | 160 | There is basic support for addressable RGB matrix lighting with the I2C IS31FL3737 RGB controller. To enable it, add this to your `rules.mk`: |
143 | 161 | ||
144 | ```makefile | 162 | ```make |
145 | RGB_MATRIX_ENABLE = yes | 163 | RGB_MATRIX_ENABLE = yes |
146 | RGB_MATRIX_DRIVER = IS31FL3737 | 164 | RGB_MATRIX_DRIVER = IS31FL3737 |
147 | ``` | 165 | ``` |
@@ -153,11 +171,25 @@ Configure the hardware via your `config.h`: | |||
153 | |----------|-------------|---------| | 171 | |----------|-------------|---------| |
154 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | 172 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | |
155 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | 173 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | |
174 | | `ISSI_SWPULLUP` | (Optional) Set the value of the SWx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | ||
175 | | `ISSI_CSPULLUP` | (Optional) Set the value of the CSx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | ||
156 | | `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | 176 | | `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 | | | 177 | | `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | | |
158 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | | 178 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | |
159 | | `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | | | 179 | | `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | | |
160 | 180 | ||
181 | The IS31FL3737 IC's have on-chip resistors that can be enabled to allow for de-ghosting of the RGB matrix. By default these resistors are not enabled (`ISSI_SWPULLUP`/`ISSI_CSPULLUP` are given the value of`PUR_0R`), the values that can be set to enable de-ghosting are as follows: | ||
182 | |||
183 | | `ISSI_SWPULLUP/ISSI_CSPULLUP` | Description | | ||
184 | |----------------------|-------------| | ||
185 | | `PUR_0R` | (default) Do not use the on-chip resistors/enable de-ghosting | | ||
186 | | `PUR_05KR` | The 0.5k Ohm resistor used during blanking period (t_NOL) | | ||
187 | | `PUR_1KR` | The 1k Ohm resistor used during blanking period (t_NOL) | | ||
188 | | `PUR_2KR` | The 2k Ohm resistor used during blanking period (t_NOL) | | ||
189 | | `PUR_4KR` | The 4k Ohm resistor used during blanking period (t_NOL) | | ||
190 | | `PUR_8KR` | The 8k Ohm resistor during blanking period (t_NOL) | | ||
191 | | `PUR_16KR` | The 16k Ohm resistor during blanking period (t_NOL) | | ||
192 | | `PUR_32KR` | The 32k Ohm resistor used during blanking period (t_NOL) | | ||
161 | 193 | ||
162 | Here is an example using 2 drivers. | 194 | Here is an example using 2 drivers. |
163 | 195 | ||
@@ -181,7 +213,7 @@ Here is an example using 2 drivers. | |||
181 | ``` | 213 | ``` |
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`. | 214 | !> 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`. |
183 | 215 | ||
184 | Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations. | 216 | Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations. |
185 | 217 | ||
186 | Define these arrays listing all the LEDs in your `<keyboard>.c`: | 218 | Define these arrays listing all the LEDs in your `<keyboard>.c`: |
187 | 219 | ||
@@ -206,7 +238,7 @@ Where `X_Y` is the location of the LED in the matrix defined by [the datasheet]( | |||
206 | 238 | ||
207 | There is basic support for addressable RGB matrix lighting with a WS2811/WS2812{a,b,c} addressable LED strand. To enable it, add this to your `rules.mk`: | 239 | There is basic support for addressable RGB matrix lighting with a WS2811/WS2812{a,b,c} addressable LED strand. To enable it, add this to your `rules.mk`: |
208 | 240 | ||
209 | ```makefile | 241 | ```make |
210 | RGB_MATRIX_ENABLE = yes | 242 | RGB_MATRIX_ENABLE = yes |
211 | RGB_MATRIX_DRIVER = WS2812 | 243 | RGB_MATRIX_DRIVER = WS2812 |
212 | ``` | 244 | ``` |
@@ -226,7 +258,7 @@ Configure the hardware via your `config.h`: | |||
226 | 258 | ||
227 | There is basic support for APA102 based addressable LED strands. To enable it, add this to your `rules.mk`: | 259 | There is basic support for APA102 based addressable LED strands. To enable it, add this to your `rules.mk`: |
228 | 260 | ||
229 | ```makefile | 261 | ```make |
230 | RGB_MATRIX_ENABLE = yes | 262 | RGB_MATRIX_ENABLE = yes |
231 | RGB_MATRIX_DRIVER = APA102 | 263 | RGB_MATRIX_DRIVER = APA102 |
232 | ``` | 264 | ``` |
@@ -246,7 +278,7 @@ Configure the hardware via your `config.h`: | |||
246 | ### AW20216 :id=aw20216 | 278 | ### 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`: | 279 | 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 | 280 | ||
249 | ```makefile | 281 | ```make |
250 | RGB_MATRIX_ENABLE = yes | 282 | RGB_MATRIX_ENABLE = yes |
251 | RGB_MATRIX_DRIVER = AW20216 | 283 | RGB_MATRIX_DRIVER = AW20216 |
252 | ``` | 284 | ``` |
@@ -340,7 +372,7 @@ x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION | |||
340 | y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION | 372 | y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION |
341 | ``` | 373 | ``` |
342 | 374 | ||
343 | Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout. | 375 | Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout. |
344 | 376 | ||
345 | As mentioned earlier, the center of the keyboard by default is expected to be `{ 112, 32 }`, but this can be changed if you want to more accurately calculate the LED's physical `{ x, y }` positions. Keyboard designers can implement `#define RGB_MATRIX_CENTER { 112, 32 }` in their config.h file with the new center point of the keyboard, or where they want it to be allowing more possibilities for the `{ x, y }` values. Do note that the maximum value for x or y is 255, and the recommended maximum is 224 as this gives animations runoff room before they reset. | 377 | As mentioned earlier, the center of the keyboard by default is expected to be `{ 112, 32 }`, but this can be changed if you want to more accurately calculate the LED's physical `{ x, y }` positions. Keyboard designers can implement `#define RGB_MATRIX_CENTER { 112, 32 }` in their config.h file with the new center point of the keyboard, or where they want it to be allowing more possibilities for the `{ x, y }` values. Do note that the maximum value for x or y is 255, and the recommended maximum is 224 as this gives animations runoff room before they reset. |
346 | 378 | ||
@@ -383,7 +415,7 @@ All RGB keycodes are currently shared with the RGBLIGHT system: | |||
383 | 415 | ||
384 | * `RGB_MODE_*` keycodes will generally work, but not all of the modes are currently mapped to the correct effects for the RGB Matrix system. | 416 | * `RGB_MODE_*` keycodes will generally work, but not all of the modes are currently mapped to the correct effects for the RGB Matrix system. |
385 | 417 | ||
386 | `RGB_MODE_PLAIN`, `RGB_MODE_BREATHE`, `RGB_MODE_RAINBOW`, and `RGB_MATRIX_SWIRL` are the only ones that are mapped properly. The rest don't have a direct equivalent, and are not mapped. | 418 | `RGB_MODE_PLAIN`, `RGB_MODE_BREATHE`, `RGB_MODE_RAINBOW`, and `RGB_MATRIX_SWIRL` are the only ones that are mapped properly. The rest don't have a direct equivalent, and are not mapped. |
387 | 419 | ||
388 | !> By default, if you have both the [RGB Light](feature_rgblight.md) and the RGB Matrix feature enabled, these keycodes will work for both features, at the same time. You can disable the keycode functionality by defining the `*_DISABLE_KEYCODES` option for the specific feature. | 420 | !> By default, if you have both the [RGB Light](feature_rgblight.md) and the RGB Matrix feature enabled, these keycodes will work for both features, at the same time. You can disable the keycode functionality by defining the `*_DISABLE_KEYCODES` option for the specific feature. |
389 | 421 | ||
@@ -420,7 +452,9 @@ enum rgb_matrix_effects { | |||
420 | RGB_MATRIX_JELLYBEAN_RAINDROPS, // Randomly changes a single key's hue and saturation | 452 | RGB_MATRIX_JELLYBEAN_RAINDROPS, // Randomly changes a single key's hue and saturation |
421 | RGB_MATRIX_HUE_BREATHING, // Hue shifts up a slight ammount at the same time, then shifts back | 453 | RGB_MATRIX_HUE_BREATHING, // Hue shifts up a slight ammount at the same time, then shifts back |
422 | RGB_MATRIX_HUE_PENDULUM, // Hue shifts up a slight ammount in a wave to the right, then back to the left | 454 | RGB_MATRIX_HUE_PENDULUM, // Hue shifts up a slight ammount in a wave to the right, then back to the left |
423 | RGB_MATRIX_HUE_WAVE, // Hue shifts up a slight ammount and then back down in a wave to the right | 455 | RGB_MATRIX_HUE_WAVE, // Hue shifts up a slight ammount and then back down in a wave to the right |
456 | RGB_MATRIX_FRACTAL, // Single hue fractal filled keys pulsing horizontally out to edges | ||
457 | RGB_MATRIX_PIXEL_RAIN, // Randomly light keys with random hues | ||
424 | #if define(RGB_MATRIX_FRAMEBUFFER_EFFECTS) | 458 | #if define(RGB_MATRIX_FRAMEBUFFER_EFFECTS) |
425 | RGB_MATRIX_TYPING_HEATMAP, // How hot is your WPM! | 459 | RGB_MATRIX_TYPING_HEATMAP, // How hot is your WPM! |
426 | RGB_MATRIX_DIGITAL_RAIN, // That famous computer simulation | 460 | RGB_MATRIX_DIGITAL_RAIN, // That famous computer simulation |
@@ -473,7 +507,9 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con | |||
473 | |`#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Disables `RGB_MATRIX_JELLYBEAN_RAINDROPS` | | 507 | |`#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Disables `RGB_MATRIX_JELLYBEAN_RAINDROPS` | |
474 | |`#define DISABLE_RGB_MATRIX_HUE_BREATHING` |Disables `RGB_MATRIX_HUE_BREATHING` | | 508 | |`#define DISABLE_RGB_MATRIX_HUE_BREATHING` |Disables `RGB_MATRIX_HUE_BREATHING` | |
475 | |`#define DISABLE_RGB_MATRIX_HUE_PENDULUM` |Disables `RGB_MATRIX_HUE_PENDULUM` | | 509 | |`#define DISABLE_RGB_MATRIX_HUE_PENDULUM` |Disables `RGB_MATRIX_HUE_PENDULUM` | |
476 | |`#define DISABLE_RGB_MATRIX_HUE_WAVE ` |Disables `RGB_MATRIX_HUE_WAVE ` | | 510 | |`#define DISABLE_RGB_MATRIX_HUE_WAVE` |Disables `RGB_MATRIX_HUE_WAVE` | |
511 | |`#define DISABLE_RGB_MATRIX_FRACTAL` |Disables `RGB_MATRIX_FRACTAL` | | ||
512 | |`#define DISABLE_RGB_MATRIX_PIXEL_RAIN ` |Disables `RGB_MATRIX_PIXEL_RAIN ` | | ||
477 | |`#define DISABLE_RGB_MATRIX_TYPING_HEATMAP` |Disables `RGB_MATRIX_TYPING_HEATMAP` | | 513 | |`#define DISABLE_RGB_MATRIX_TYPING_HEATMAP` |Disables `RGB_MATRIX_TYPING_HEATMAP` | |
478 | |`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` | | 514 | |`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` | |
479 | |`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` | | 515 | |`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` | |
@@ -537,7 +573,7 @@ static bool my_cool_effect(effect_params_t* params) { | |||
537 | for (uint8_t i = led_min; i < led_max; i++) { | 573 | for (uint8_t i = led_min; i < led_max; i++) { |
538 | rgb_matrix_set_color(i, 0xff, 0xff, 0x00); | 574 | rgb_matrix_set_color(i, 0xff, 0xff, 0x00); |
539 | } | 575 | } |
540 | return led_max < DRIVER_LED_TOTAL; | 576 | return rgb_matrix_check_finished_leds(led_max); |
541 | } | 577 | } |
542 | 578 | ||
543 | // e.g: A more complex effect, relying on external methods and state, with | 579 | // e.g: A more complex effect, relying on external methods and state, with |
@@ -551,8 +587,7 @@ static bool my_cool_effect2_complex_run(effect_params_t* params) { | |||
551 | for (uint8_t i = led_min; i < led_max; i++) { | 587 | for (uint8_t i = led_min; i < led_max; i++) { |
552 | rgb_matrix_set_color(i, 0xff, some_global_state++, 0xff); | 588 | rgb_matrix_set_color(i, 0xff, some_global_state++, 0xff); |
553 | } | 589 | } |
554 | 590 | return rgb_matrix_check_finished_leds(led_max); | |
555 | return led_max < DRIVER_LED_TOTAL; | ||
556 | } | 591 | } |
557 | static bool my_cool_effect2(effect_params_t* params) { | 592 | static bool my_cool_effect2(effect_params_t* params) { |
558 | if (params->init) my_cool_effect2_complex_init(params); | 593 | if (params->init) my_cool_effect2_complex_init(params); |
@@ -694,7 +729,7 @@ Where `28` is an unused index from `eeconfig.h`. | |||
694 | 729 | ||
695 | ### Indicators :id=indicators | 730 | ### Indicators :id=indicators |
696 | 731 | ||
697 | If you want to set custom indicators, such as an LED for Caps Lock, or layer indication, you can use the `rgb_matrix_indicators_kb` or `rgb_matrix_indicators_user` function for that: | 732 | If you want to set custom indicators, such as an LED for Caps Lock, or layer indication, you can use the `rgb_matrix_indicators_kb` or `rgb_matrix_indicators_user` function for that: |
698 | ```c | 733 | ```c |
699 | void rgb_matrix_indicators_kb(void) { | 734 | void rgb_matrix_indicators_kb(void) { |
700 | rgb_matrix_set_color(index, red, green, blue); | 735 | rgb_matrix_set_color(index, red, green, blue); |
@@ -749,18 +784,18 @@ This example sets the modifiers to be a specific color based on the layer state. | |||
749 | ```c | 784 | ```c |
750 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | 785 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { |
751 | HSV hsv = {0, 255, 255}; | 786 | HSV hsv = {0, 255, 255}; |
752 | 787 | ||
753 | if (layer_state_is(layer_state, 2)) { | 788 | if (layer_state_is(layer_state, 2)) { |
754 | hsv = {130, 255, 255}; | 789 | hsv = {130, 255, 255}; |
755 | } else { | 790 | } else { |
756 | hsv = {30, 255, 255}; | 791 | hsv = {30, 255, 255}; |
757 | } | 792 | } |
758 | 793 | ||
759 | if (hsv.v > rgb_matrix_get_val()) { | 794 | if (hsv.v > rgb_matrix_get_val()) { |
760 | hsv.v = rgb_matrix_get_val(); | 795 | hsv.v = rgb_matrix_get_val(); |
761 | } | 796 | } |
762 | RGB rgb = hsv_to_rgb(hsv); | 797 | RGB rgb = hsv_to_rgb(hsv); |
763 | 798 | ||
764 | for (uint8_t i = led_min; i <= led_max; i++) { | 799 | for (uint8_t i = led_min; i <= led_max; i++) { |
765 | if (HAS_FLAGS(g_led_config.flags[i], 0x01)) { // 0x01 == LED_FLAG_MODIFIER | 800 | if (HAS_FLAGS(g_led_config.flags[i], 0x01)) { // 0x01 == LED_FLAG_MODIFIER |
766 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 801 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
@@ -769,7 +804,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | |||
769 | } | 804 | } |
770 | ``` | 805 | ``` |
771 | 806 | ||
772 | If you want to indicate a Host LED status (caps lock, num lock, etc), you can use something like this to light up the caps lock key: | 807 | If you want to indicate a Host LED status (caps lock, num lock, etc), you can use something like this to light up the caps lock key: |
773 | 808 | ||
774 | ```c | 809 | ```c |
775 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | 810 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { |