aboutsummaryrefslogtreecommitdiff
path: root/docs/feature_rgb_matrix.md
diff options
context:
space:
mode:
authorGigahawk <jasperchan515@gmail.com>2021-06-09 18:40:25 -0700
committerGitHub <noreply@github.com>2021-06-10 11:40:25 +1000
commit32b2ac0a807bdb088df685e6118f4c0966b6cca4 (patch)
treec1720e551dc875bd585dc1136f4f99ea00f23c28 /docs/feature_rgb_matrix.md
parente21a03990116b439de2d4a0181f4a87d048e0366 (diff)
downloadqmk_firmware-32b2ac0a807bdb088df685e6118f4c0966b6cca4.tar.gz
qmk_firmware-32b2ac0a807bdb088df685e6118f4c0966b6cca4.zip
GMMK Pro RGB Support (#13147)
* Enable SPI1 for GMMK pro * Setup initial boilerplate for new LED driver * RGB matrix minimally functional * Map full LED matrix * Return keymap to default * Fix printscreen LED mapping * Reduce max brightness * Default values for AW20216 * Add documentation for AW20216 * Disable console and warnings * Run cformat * Update drivers/awinic/aw20216.h Co-authored-by: Drashna Jaelre <drashna@live.com> * make aw struct match issi struct Co-authored-by: Drashna Jaelre <drashna@live.com> * add led location defines Co-authored-by: Drashna Jaelre <drashna@live.com> * Use led pin definitions in keyboard.c * Add driver indices to led map * Fix elif typo * Run cformat * Update docs * Fix typo in docs * Document global brightness limits Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'docs/feature_rgb_matrix.md')
-rw-r--r--docs/feature_rgb_matrix.md68
1 files changed, 68 insertions, 0 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 169443fb8..afd72fecf 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -228,6 +228,74 @@ 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
254Here is an example using 2 drivers.
255
256```c
257#define DRIVER_1_CS B13
258#define DRIVER_2_CS B14
259// Hardware enable lines may be connected to the same pin
260#define DRIVER_1_EN C13
261#define DRIVER_2_EN C13
262
263#define DRIVER_COUNT 2
264#define DRIVER_1_LED_TOTAL 66
265#define DRIVER_2_LED_TOTAL 32
266#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
267```
268
269!> 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`.
270
271Define these arrays listing all the LEDs in your `<keyboard>.c`:
272
273```c
274const aw_led g_aw_leds[DRIVER_LED_TOTAL] = {
275/* Each AW20216 channel is controlled by a register at some offset between 0x00
276 * and 0xD7 inclusive.
277 * See drivers/awinic/aw20216.h for the mapping between register offsets and
278 * driver pin locations.
279 * driver
280 * | R location
281 * | | G location
282 * | | | B location
283 * | | | | */
284 { 0, CS1_SW1, CS2_SW1, CS3_SW1 },
285 { 0, CS4_SW1, CS5_SW1, CS6_SW1 },
286 { 0, CS7_SW1, CS8_SW1, CS9_SW1 },
287 { 0, CS10_SW1, CS11_SW1, CS12_SW1 },
288 { 0, CS13_SW1, CS14_SW1, CS15_SW1 },
289 ...
290 { 1, CS1_SW1, CS2_SW1, CS3_SW1 },
291 { 1, CS13_SW1, CS14_SW1, CS15_SW1 },
292 { 1, CS16_SW1, CS17_SW1, CS18_SW1 },
293 { 1, CS4_SW2, CS5_SW2, CS6_SW2 },
294 ...
295};
296```
297
298---
231 299
232From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example: 300From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example:
233 301