aboutsummaryrefslogtreecommitdiff
path: root/docs/feature_rgb_matrix.md
diff options
context:
space:
mode:
authordonicrosby <doni.crosby1995@gmail.com>2021-11-01 19:40:01 -0400
committerGitHub <noreply@github.com>2021-11-02 10:40:01 +1100
commit0c725017638ec86011191bf835735fb6c569d298 (patch)
treed5c1076063ade21423de710ae9837b6edd16ae80 /docs/feature_rgb_matrix.md
parent7ae0f371cf55a589a4735098f52e722f579de41d (diff)
downloadqmk_firmware-0c725017638ec86011191bf835735fb6c569d298.tar.gz
qmk_firmware-0c725017638ec86011191bf835735fb6c569d298.zip
Enable de-ghosting for RGB/LED matrix on all ISSI LED drivers (#14508)
* Initial work for de-ghost enable * Dumb mistake with the redefine * Added Copywrite stuff on source files * Fixed whitespace errors * Added support for all ISSI LED drivers * Updated docs for support for ISSI LED driver pull-up pull-down * Applied clang format * Added 'boolean' flag to enable de-ghosting for the is31fl3731 IC * Fixed some of the grammer in the docs * Fixed comment placement and grammer of comment * Fixed whitespace errors from lint Co-authored-by: donicrosby <donicrosby1995@gmail.com>
Diffstat (limited to 'docs/feature_rgb_matrix.md')
-rw-r--r--docs/feature_rgb_matrix.md47
1 files changed, 38 insertions, 9 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index fa06e46e4..cad7c50f1 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -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 | |
@@ -85,6 +86,8 @@ You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_<N>` de
85| `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 |
86| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | 87| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 |
87| `ISSI_PWM_FREQUENCY` | (Optional) PWM Frequency Setting - IS31FL3733B only | 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) |
88| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | 91| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
89| `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 | |
90| `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | 93| `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | |
@@ -96,6 +99,18 @@ You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_<N>` de
96| `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 |
97| `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 |
98 101
102The 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
99Here is an example using 2 drivers. 114Here is an example using 2 drivers.
100 115
101```c 116```c
@@ -156,11 +171,25 @@ Configure the hardware via your `config.h`:
156|----------|-------------|---------| 171|----------|-------------|---------|
157| `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 |
158| `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) |
159| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | 176| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
160| `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 | |
161| `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | 178| `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | |
162| `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | | 179| `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | |
163 180
181The 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) |
164 193
165Here is an example using 2 drivers. 194Here is an example using 2 drivers.
166 195
@@ -184,7 +213,7 @@ Here is an example using 2 drivers.
184``` 213```
185!> 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`.
186 215
187Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations. 216Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
188 217
189Define these arrays listing all the LEDs in your `<keyboard>.c`: 218Define these arrays listing all the LEDs in your `<keyboard>.c`:
190 219
@@ -343,7 +372,7 @@ x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION
343y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION 372y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION
344``` 373```
345 374
346Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout. 375Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout.
347 376
348As 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. 377As 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.
349 378
@@ -386,7 +415,7 @@ All RGB keycodes are currently shared with the RGBLIGHT system:
386 415
387* `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.
388 417
389`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.
390 419
391!> 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.
392 421
@@ -423,7 +452,7 @@ enum rgb_matrix_effects {
423 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
424 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
425 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
426 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
427 RGB_MATRIX_FRACTAL, // Single hue fractal filled keys pulsing horizontally out to edges 456 RGB_MATRIX_FRACTAL, // Single hue fractal filled keys pulsing horizontally out to edges
428#if define(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 457#if define(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
429 RGB_MATRIX_TYPING_HEATMAP, // How hot is your WPM! 458 RGB_MATRIX_TYPING_HEATMAP, // How hot is your WPM!
@@ -698,7 +727,7 @@ Where `28` is an unused index from `eeconfig.h`.
698 727
699### Indicators :id=indicators 728### Indicators :id=indicators
700 729
701If 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: 730If 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:
702```c 731```c
703void rgb_matrix_indicators_kb(void) { 732void rgb_matrix_indicators_kb(void) {
704 rgb_matrix_set_color(index, red, green, blue); 733 rgb_matrix_set_color(index, red, green, blue);
@@ -753,18 +782,18 @@ This example sets the modifiers to be a specific color based on the layer state.
753```c 782```c
754void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { 783void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
755 HSV hsv = {0, 255, 255}; 784 HSV hsv = {0, 255, 255};
756 785
757 if (layer_state_is(layer_state, 2)) { 786 if (layer_state_is(layer_state, 2)) {
758 hsv = {130, 255, 255}; 787 hsv = {130, 255, 255};
759 } else { 788 } else {
760 hsv = {30, 255, 255}; 789 hsv = {30, 255, 255};
761 } 790 }
762 791
763 if (hsv.v > rgb_matrix_get_val()) { 792 if (hsv.v > rgb_matrix_get_val()) {
764 hsv.v = rgb_matrix_get_val(); 793 hsv.v = rgb_matrix_get_val();
765 } 794 }
766 RGB rgb = hsv_to_rgb(hsv); 795 RGB rgb = hsv_to_rgb(hsv);
767 796
768 for (uint8_t i = led_min; i <= led_max; i++) { 797 for (uint8_t i = led_min; i <= led_max; i++) {
769 if (HAS_FLAGS(g_led_config.flags[i], 0x01)) { // 0x01 == LED_FLAG_MODIFIER 798 if (HAS_FLAGS(g_led_config.flags[i], 0x01)) { // 0x01 == LED_FLAG_MODIFIER
770 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); 799 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
@@ -773,7 +802,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
773} 802}
774``` 803```
775 804
776If 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: 805If 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:
777 806
778```c 807```c
779void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { 808void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {