RGB Matrix docs update from mechmerlin discussion (#5667)

* RGB Matrix docs update from mechmerlin discussion

* alignment

* Apply suggestions from code review

Co-Authored-By: XScorpion2 <rcalt2vt@gmail.com>
master
XScorpion2 2019-04-20 20:21:22 -05:00 committed by MechMerlin
parent ff9cd1dd0c
commit 829ccd3491
1 changed files with 5 additions and 5 deletions

View File

@ -124,7 +124,7 @@ Configure the hardware via your `config.h`:
---
From this point forward the configuration is the same for all the drivers.
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] = {
@ -138,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).