From 829ccd3491ca43be79e110b12bdabe96d6e76b0f Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sat, 20 Apr 2019 20:21:22 -0500 Subject: [PATCH] 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 --- docs/feature_rgb_matrix.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 05c1ebba815..acef4717dde 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -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).