]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - docs/feature_rgb_matrix.md
RGB Matrix docs update from mechmerlin discussion (#5667)
[qmk_firmware.git] / docs / feature_rgb_matrix.md
index 36d9d0113626d1e34af907fd38950f783946b4f7..acef4717ddeaee9728f93c2d2148577076ab3172 100644 (file)
@@ -5,7 +5,7 @@ This feature allows you to use RGB LED matrices driven by external drivers. It h
 If you want to use single color LED's you should use the [LED Matrix Subsystem](feature_led_matrix.md) instead.
 
 ## Driver configuration
-
+---
 ### IS31FL3731
 
 There is basic support for addressable RGB matrix lighting with the I2C IS31FL3731 RGB controller. To enable it, add this to your `rules.mk`:
@@ -52,6 +52,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
 
 Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](http://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).
 
+---
 ###  IS31FL3733/IS31FL3737
 
 !> For the IS31FL3737, replace all instances of `IS31FL3733` below with `IS31FL3737`.
@@ -102,7 +103,28 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
 
 Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](http://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).
 
-From this point forward the configuration is the same for all the drivers. 
+---
+
+### WS2812 (AVR only)
+
+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`:
+
+```C
+RGB_MATRIX_ENABLE = WS2812
+```
+
+Configure the hardware via your `config.h`:
+
+```C
+// The pin connected to the data pin of the LEDs
+#define RGB_DI_PIN D7
+// The number of LEDs connected
+#define DRIVER_LED_TOTAL 70
+```
+
+---
+
+From this point forward the configuration is the same for all the drivers. The struct rgb_led array tells the system for each led, what key electrical matrix it represents, what the physical position is on the board, and if the led is for a modifier key or not. Here is a brief example:
 
 ```C
 const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
@@ -116,14 +138,14 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
 }
 ```
 
-The format for the matrix position used in this array is `{row | (col << 4)}`. The `x` is between (inclusive) 0-224, and `y` is between (inclusive) 0-64. The easiest way to calculate these positions is:
+The first part, `{row | col << 4}`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `{x=0..224, y=0..64}` represents the LED's physical position on the keyboard. The `x` is between (inclusive) 0-224, and `y` is between (inclusive) 0-64 as the effects are based on this range. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents x, y coordinate 0, 0 and the bottom right of your keyboard represents 224, 64. Using this as a basis, you can use the following formula to calculate the physical position:
 
 ```C
-x = 224 / ( NUMBER_OF_COLS - 1 ) * ROW_POSITION
-y = 64 / (NUMBER_OF_ROWS - 1 ) * COL_POSITION
+x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION
+y =  64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION
 ```
 
-Where all variables are decimels/floats.
+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.
 
 `modifier` is a boolean, whether or not a certain key is considered a modifier (used in some effects).
 
@@ -231,10 +253,10 @@ A similar function works in the keymap as `rgb_matrix_indicators_user`.
 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:
 
 ```C
-#define EECONFIG_RGB_MATRIX (uint32_t *)16
+#define EECONFIG_RGB_MATRIX (uint32_t *)28
 ```
 
-Where `16` is an unused index from `eeconfig.h`.
+Where `28` is an unused index from `eeconfig.h`.
 
 ## Suspended state