diff options
| author | XScorpion2 <rcalt2vt@gmail.com> | 2019-04-20 20:21:22 -0500 |
|---|---|---|
| committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-04-20 18:21:22 -0700 |
| commit | 829ccd3491ca43be79e110b12bdabe96d6e76b0f (patch) | |
| tree | fad75344752a7e708c31c0f673fa639e5d065f7f /docs/feature_rgb_matrix.md | |
| parent | ff9cd1dd0c2cc3be2a25b388eab183f6ff20b5b6 (diff) | |
| download | qmk_firmware-829ccd3491ca43be79e110b12bdabe96d6e76b0f.tar.gz qmk_firmware-829ccd3491ca43be79e110b12bdabe96d6e76b0f.zip | |
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>
Diffstat (limited to 'docs/feature_rgb_matrix.md')
| -rw-r--r-- | docs/feature_rgb_matrix.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 05c1ebba8..acef4717d 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
| @@ -124,7 +124,7 @@ Configure the hardware via your `config.h`: | |||
| 124 | 124 | ||
| 125 | --- | 125 | --- |
| 126 | 126 | ||
| 127 | From this point forward the configuration is the same for all the drivers. | 127 | 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: |
| 128 | 128 | ||
| 129 | ```C | 129 | ```C |
| 130 | const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { | 130 | const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { |
| @@ -138,14 +138,14 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { | |||
| 138 | } | 138 | } |
| 139 | ``` | 139 | ``` |
| 140 | 140 | ||
| 141 | 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: | 141 | 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: |
| 142 | 142 | ||
| 143 | ```C | 143 | ```C |
| 144 | x = 224 / ( NUMBER_OF_COLS - 1 ) * ROW_POSITION | 144 | x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION |
| 145 | y = 64 / (NUMBER_OF_ROWS - 1 ) * COL_POSITION | 145 | y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION |
| 146 | ``` | 146 | ``` |
| 147 | 147 | ||
| 148 | Where all variables are decimels/floats. | 148 | 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. |
| 149 | 149 | ||
| 150 | `modifier` is a boolean, whether or not a certain key is considered a modifier (used in some effects). | 150 | `modifier` is a boolean, whether or not a certain key is considered a modifier (used in some effects). |
| 151 | 151 | ||
