diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2025-10-04 11:43:42 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2025-10-04 11:43:42 +0200 |
commit | e23b3c87c2d1e3056c89834f4c34c3a289ba3b81 (patch) | |
tree | b8296c8d5f05ff626de0ee2eeb322f7374937e92 /qmk/keyboards/sofle_choc/keymaps/custom/lighting.c | |
parent | 4d42af985e96d5e5b4d4289dce401a215e607cd6 (diff) |
Added a led for the star key for ergo-l
Diffstat (limited to 'qmk/keyboards/sofle_choc/keymaps/custom/lighting.c')
-rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/lighting.c | 85 |
1 files changed, 46 insertions, 39 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c b/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c index 3e4c5b0..3060dce 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c @@ -2,6 +2,10 @@ uint8_t flags = 0; #include "keycodes.h" +// The variable is defined in star_key.h +// The LED is on when the key is pressed. +extern bool is_star; + // Set the color at the given position, but limit the intensity void set_color(uint8_t index, uint8_t h, uint8_t s, uint8_t _) { HSV hsv = {h, s, RGB_MATRIX_MAXIMUM_BRIGHTNESS}; @@ -17,7 +21,7 @@ HSV hsv_of_color(uint8_t h, uint8_t s, uint8_t v) { #define KEY_DOWN MT(MOD_RCTL, KC_DOWN) bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { // Activate effects depending of mods - + // Colors for the mods HSV const colors[] = { hsv_of_color(HSV_BLACK), // 000 @@ -53,44 +57,47 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { counter += 1; } - if (get_highest_layer(layer_state) > 0) { - for (uint8_t row = 0; row < MATRIX_ROWS; ++row) { - for (uint8_t col = 0; col < MATRIX_COLS; ++col) { - uint8_t index = g_led_config.matrix_co[row][col]; - - if (index < led_min || index > led_max || index == NO_LED) - continue; - - uint8_t layer = layer_switch_get_layer((keypos_t){col,row}); - if (layer == 0) - continue; - - uint16_t keycode = keymap_key_to_keycode(layer, (keypos_t){col,row}); - - switch (keycode) { - case KC_F1 ... KC_F11: - rgb_matrix_set_color(index, 128, 128, 128); - break; - case KC_P1 ... KC_P0: - case KEY_5: - rgb_matrix_set_color(index, 100, 100, 0); - break; - case KC_RIGHT: - case KEY_DOWN: - case KC_LEFT ... KC_UP: - case KC_PGUP: - case KC_PGDN: - rgb_matrix_set_color(index, 32, 32, 128); - break; - case KC_HOME: - case KC_END: - rgb_matrix_set_color(index, RGB_SPRINGGREEN); - break; - case AL_SPC: - case AL_ENT: - set_color(index, HSV_BLUE); - break; - } + for (uint8_t row = 0; row < MATRIX_ROWS; ++row) { + for (uint8_t col = 0; col < MATRIX_COLS; ++col) { + uint8_t index = g_led_config.matrix_co[row][col]; + + if (index < led_min || index > led_max || index == NO_LED) + continue; + + uint8_t layer = layer_switch_get_layer((keypos_t){col,row}); + uint16_t keycode = keymap_key_to_keycode(layer, (keypos_t){col,row}); + + if (keycode == KC_O && is_star) { + rgb_matrix_set_color(index, 100, 100, 0); + } + + if (layer == 0) + continue; + + + switch (keycode) { + case KC_F1 ... KC_F11: + rgb_matrix_set_color(index, 128, 128, 128); + break; + case KC_P1 ... KC_P0: + case KEY_5: + rgb_matrix_set_color(index, 100, 100, 0); + break; + case KC_RIGHT: + case KEY_DOWN: + case KC_LEFT ... KC_UP: + case KC_PGUP: + case KC_PGDN: + rgb_matrix_set_color(index, 32, 32, 128); + break; + case KC_HOME: + case KC_END: + rgb_matrix_set_color(index, RGB_SPRINGGREEN); + break; + case AL_SPC: + case AL_ENT: + set_color(index, HSV_BLUE); + break; } } |