diff options
Diffstat (limited to 'docs/feature_rgb_matrix.md')
-rw-r--r-- | docs/feature_rgb_matrix.md | 105 |
1 files changed, 92 insertions, 13 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index dd9c98c5e..169443fb8 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
@@ -15,7 +15,20 @@ RGB_MATRIX_ENABLE = yes | |||
15 | RGB_MATRIX_DRIVER = IS31FL3731 | 15 | RGB_MATRIX_DRIVER = IS31FL3731 |
16 | ``` | 16 | ``` |
17 | 17 | ||
18 | Configure the hardware via your `config.h`: | 18 | You can use between 1 and 4 IS31FL3731 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`: |
19 | |||
20 | | Variable | Description | Default | | ||
21 | |----------|-------------|---------| | ||
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 | | ||
24 | | `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_ADDR_1` | (Required) Address for the first RGB driver | | | ||
27 | | `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | | | ||
28 | | `DRIVER_ADDR_3` | (Optional) Address for the third RGB driver | | | ||
29 | | `DRIVER_ADDR_4` | (Optional) Address for the fourth RGB driver | | | ||
30 | |||
31 | Here is an example using 2 drivers. | ||
19 | 32 | ||
20 | ```c | 33 | ```c |
21 | // This is a 7-bit address, that gets left-shifted and bit 0 | 34 | // This is a 7-bit address, that gets left-shifted and bit 0 |
@@ -36,8 +49,6 @@ Configure the hardware via your `config.h`: | |||
36 | 49 | ||
37 | !> 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`. | 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`. |
38 | 51 | ||
39 | Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations. | ||
40 | |||
41 | Define these arrays listing all the LEDs in your `<keyboard>.c`: | 52 | Define these arrays listing all the LEDs in your `<keyboard>.c`: |
42 | 53 | ||
43 | ```c | 54 | ```c |
@@ -53,12 +64,10 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | |||
53 | } | 64 | } |
54 | ``` | 65 | ``` |
55 | 66 | ||
56 | Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731.h`. The `driver` is the index of the driver you defined in your `config.h` (`0` or `1` right now). | 67 | Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3`). |
57 | 68 | ||
58 | --- | 69 | --- |
59 | ### IS31FL3733/IS31FL3737 :id=is31fl3733is31fl3737 | 70 | ### IS31FL3733 :id=is31fl3733 |
60 | |||
61 | !> For the IS31FL3737, replace all instances of `IS31FL3733` below with `IS31FL3737`. | ||
62 | 71 | ||
63 | There is basic support for addressable RGB matrix lighting with the I2C IS31FL3733 RGB controller. To enable it, add this to your `rules.mk`: | 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`: |
64 | 73 | ||
@@ -67,7 +76,24 @@ RGB_MATRIX_ENABLE = yes | |||
67 | RGB_MATRIX_DRIVER = IS31FL3733 | 76 | RGB_MATRIX_DRIVER = IS31FL3733 |
68 | ``` | 77 | ``` |
69 | 78 | ||
70 | Configure the hardware via your `config.h`: | 79 | You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`: |
80 | |||
81 | | Variable | Description | Default | | ||
82 | |----------|-------------|---------| | ||
83 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | ||
84 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | ||
85 | | `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 | | | ||
87 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | | ||
88 | | `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | | | ||
89 | | `DRIVER_ADDR_3` | (Optional) Address for the third RGB driver | | | ||
90 | | `DRIVER_ADDR_4` | (Optional) Address for the fourth RGB driver | | | ||
91 | | `DRIVER_SYNC_1` | (Optional) Sync configuration for the first RGB driver | 0 | | ||
92 | | `DRIVER_SYNC_2` | (Optional) Sync configuration for the second RGB driver | 0 | | ||
93 | | `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 | | ||
95 | |||
96 | Here is an example using 2 drivers. | ||
71 | 97 | ||
72 | ```c | 98 | ```c |
73 | // This is a 7-bit address, that gets left-shifted and bit 0 | 99 | // This is a 7-bit address, that gets left-shifted and bit 0 |
@@ -81,6 +107,58 @@ Configure the hardware via your `config.h`: | |||
81 | // ADDR2 represents A3:A2 of the 7-bit address. | 107 | // ADDR2 represents A3:A2 of the 7-bit address. |
82 | // The result is: 0b101(ADDR2)(ADDR1) | 108 | // The result is: 0b101(ADDR2)(ADDR1) |
83 | #define DRIVER_ADDR_1 0b1010000 | 109 | #define DRIVER_ADDR_1 0b1010000 |
110 | #define DRIVER_ADDR_2 0b1010011 | ||
111 | |||
112 | #define DRIVER_COUNT 2 | ||
113 | #define DRIVER_1_LED_TOTAL 58 | ||
114 | #define DRIVER_2_LED_TOTAL 10 | ||
115 | #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | ||
116 | ``` | ||
117 | |||
118 | !> 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`. | ||
119 | |||
120 | Currently only 4 drivers are supported, but it would be trivial to support all 8 combinations. | ||
121 | |||
122 | Define these arrays listing all the LEDs in your `<keyboard>.c`: | ||
123 | |||
124 | ```c | ||
125 | const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | ||
126 | /* Refer to IS31 manual for these locations | ||
127 | * driver | ||
128 | * | R location | ||
129 | * | | G location | ||
130 | * | | | B location | ||
131 | * | | | | */ | ||
132 | {0, B_1, A_1, C_1}, | ||
133 | .... | ||
134 | } | ||
135 | ``` | ||
136 | |||
137 | Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3733.pdf) and the header file `drivers/issi/is31fl3733.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` for now). | ||
138 | |||
139 | --- | ||
140 | ### IS31FL3737 :id=is31fl3737 | ||
141 | |||
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`: | ||
143 | |||
144 | ```makefile | ||
145 | RGB_MATRIX_ENABLE = yes | ||
146 | RGB_MATRIX_DRIVER = IS31FL3737 | ||
147 | ``` | ||
148 | |||
149 | Configure the hardware via your `config.h`: | ||
150 | |||
151 | ```c | ||
152 | // 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) | ||
154 | // The address will vary depending on your wiring: | ||
155 | // 0000 <-> GND | ||
156 | // 0101 <-> SCL | ||
157 | // 1010 <-> SDA | ||
158 | // 1111 <-> VCC | ||
159 | // ADDR represents A3:A0 of the 7-bit address. | ||
160 | // The result is: 0b101(ADDR) | ||
161 | #define DRIVER_ADDR_1 0b1010000 | ||
84 | #define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons. | 162 | #define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons. |
85 | 163 | ||
86 | #define DRIVER_COUNT 2 | 164 | #define DRIVER_COUNT 2 |
@@ -105,7 +183,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | |||
105 | } | 183 | } |
106 | ``` | 184 | ``` |
107 | 185 | ||
108 | Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3733.pdf) and the header file `drivers/issi/is31fl3733.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0` right now). | 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). |
109 | 187 | ||
110 | --- | 188 | --- |
111 | 189 | ||
@@ -284,7 +362,6 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con | |||
284 | 362 | ||
285 | |Define |Description | | 363 | |Define |Description | |
286 | |-------------------------------------------------------|-----------------------------------------------| | 364 | |-------------------------------------------------------|-----------------------------------------------| |
287 | |`#define DISABLE_RGB_MATRIX_SOLID_COLOR` |Disables `RGB_MATRIX_SOLID_COLOR` | | ||
288 | |`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` | | 365 | |`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` | |
289 | |`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` | | 366 | |`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` | |
290 | |`#define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT` |Disables `MATRIX_GRADIENT_LEFT_RIGHT` | | 367 | |`#define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT` |Disables `MATRIX_GRADIENT_LEFT_RIGHT` | |
@@ -399,7 +476,7 @@ static bool my_cool_effect2(effect_params_t* params) { | |||
399 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 476 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
400 | ``` | 477 | ``` |
401 | 478 | ||
402 | For inspiration and examples, check out the built-in effects under `quantum/rgb_matrix_animation/` | 479 | For inspiration and examples, check out the built-in effects under `quantum/rgb_matrix_animations/` |
403 | 480 | ||
404 | 481 | ||
405 | ## Colors :id=colors | 482 | ## Colors :id=colors |
@@ -438,7 +515,7 @@ These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blo | |||
438 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS // enable framebuffer effects | 515 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS // enable framebuffer effects |
439 | #define RGB_DISABLE_TIMEOUT 0 // number of milliseconds to wait until rgb automatically turns off | 516 | #define RGB_DISABLE_TIMEOUT 0 // number of milliseconds to wait until rgb automatically turns off |
440 | #define RGB_DISABLE_AFTER_TIMEOUT 0 // OBSOLETE: number of ticks to wait until disabling effects | 517 | #define RGB_DISABLE_AFTER_TIMEOUT 0 // OBSOLETE: number of ticks to wait until disabling effects |
441 | #define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended | 518 | #define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended |
442 | #define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) | 519 | #define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) |
443 | #define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) | 520 | #define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) |
444 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 | 521 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 |
@@ -448,11 +525,13 @@ These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blo | |||
448 | #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set | 525 | #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set |
449 | #define RGB_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set | 526 | #define RGB_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set |
450 | #define RGB_MATRIX_DISABLE_KEYCODES // disables control of rgb matrix by keycodes (must use code functions to control the feature) | 527 | #define RGB_MATRIX_DISABLE_KEYCODES // disables control of rgb matrix by keycodes (must use code functions to control the feature) |
528 | #define RGB_MATRIX_SPLIT { X, Y } // (Optional) For split keyboards, the number of LEDs connected on each half. X = left, Y = Right. | ||
529 | // If RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is enabled, you also will want to enable SPLIT_TRANSPORT_MIRROR | ||
451 | ``` | 530 | ``` |
452 | 531 | ||
453 | ## EEPROM storage :id=eeprom-storage | 532 | ## EEPROM storage :id=eeprom-storage |
454 | 533 | ||
455 | The EEPROM for it is currently shared with the RGBLIGHT system (it's generally assumed only one RGB would be used at a time), but could be configured to use its own 32bit address with: | 534 | The EEPROM for it is currently shared with the LED Matrix system (it's generally assumed only one feature would be used at a time), but could be configured to use its own 32bit address with: |
456 | 535 | ||
457 | ```c | 536 | ```c |
458 | #define EECONFIG_RGB_MATRIX (uint32_t *)28 | 537 | #define EECONFIG_RGB_MATRIX (uint32_t *)28 |