You’ll want to clone the branch for the latest release. I wrote a little step-by-step here
• Controlling a particular key’s LED / per key color, step-by-step.
You can use this function to set the color of a given LED.
rgb_matrix_set_color(index, r, g, b)
docs.qmk.fm/#/feature_rgb_matrix?id=direct-operation
It would be placed into your keymap.c file. Exactly where you’d put it depends on what you’re looking to do.
But you see that the rgb_matrix_set_color(index, r, g, b) function requires the index number of the LED. You’ll have to look that up.
It’s not obvious how to do it, and it’s a multi-step process cross-referencing files, for each and every key. So it really needs a step-by-step how-to.
Step-by-step, Finding LED index numbers for each key
Let’s use the macropad as an example. I believe you would find the LED index like this:
Go to /framework/macropad/macropad.h and find the keymatrix location for the key you wish to control.
#define LAYOUT( \
H1, H2, H3, H4, \
K90, K95, K100, K105, \
K91, K96, K101, K107, \
K92, K97, K102, K106, \
K93, K98, K103, K109, \
K99, K110, K104, K108 \
) \
{ \
{ K90, K91, K92, K93, K95, K96, K97, K98 }, \
{ K99, K100, K101, K102, K103, K104, K105, K106 }, \
{ K108, H1, H2, KC_NO, H4, K107, K109, K110 }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, H3, KC_NO, KC_NO, KC_NO }, \
}
Say you want the top left key, that’s H1 in the LAYOUT section.
#define LAYOUT( \
H1, H2, H3, H4, \
Now find H1 in the keymatrix section right below it. Note its location within this section. It’s at row 3, column 2.
{ K108, H1, H2, KC_NO, H4, K107, K109, K110 }, \
Now go to /framework/macropad/macropad.c and search for “Key Matrix to LED Index”.
led_config_t g_led_config = { {
// Key Matrix to LED Index
{ 4, 7, 6, 9, 0, 1, 3, 11, },
{ 8, 20, 21, 23, 15, 14, 18, 19, },
{ 12, 5, 2, NO_LED, 17, 16, 13, 10, },
{NO_LED, NO_LED, NO_LED, NO_LED, 22, NO_LED, NO_LED, NO_LED, },
}
Go to the matching location, row 3, column 2. You find a number 5 at that location.
{ 12, 5, 2, NO_LED, 17, 16, 13, 10, },
Your LED index for that key is 5.
So then to control that particular key you would use
rgb_matrix_set_color(5, r, g, b)
Since I was I looking through it, I went ahead and banged out the Macropad LED index numbers.
/* Macropad key location to LED Index
* ┌────┬────┬────┬────┐
* row 1 │ 5 │ 2 │ 22 │ 17 │
* ├────┼────┼────┼────┤
* row 2 │ 4 │ 0 │ 20 │ 18 │
* ├────┼────┼────┼────┤
* row 3 │ 7 │ 1 │ 21 │ 16 │
* ├────┼────┼────┼────┤
* row 4 │ 6 │ 3 │ 23 │ 19 │
* ├────┼────┼────┼────┤
* row 5 │ 9 │ 11 │ 15 │ 13 │
* ├────┼────┼────┼────┤
* row 6 │ 8 │ 10 │ 14 │ 12 │
* └────┴────┴────┴────┘
* 24 keys and LEDs total
*/
It’s in a comment block so that you can just throw it into your keymap.c for future reference.
Let me know if you discover any to be wrong.
.
Disclaimer, I don’t yet have a FWL16, I’ve just used qmk on other devices.