diff options
Diffstat (limited to 'keyboards/kbdfans/kbd6x')
-rw-r--r-- | keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h | 1 | ||||
-rw-r--r-- | keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c | 42 | ||||
-rw-r--r-- | keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk | 22 |
3 files changed, 52 insertions, 13 deletions
diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h b/keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h index 16387fa2f6..4b511eb848 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h @@ -1,4 +1,3 @@ #pragma once #define LAYER_FN -#define SEND_STRING_CLEAN diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c index b348b0b7bf..c5c8c09636 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c @@ -10,7 +10,7 @@ enum layers_keymap { }; void eeconfig_init_keymap(void) { - rgblight_sethsv(MODERN_DOLCH_RED.h, MODERN_DOLCH_RED.s, MODERN_DOLCH_RED.v); + rgblight_sethsv(MODERN_DOLCH_RED); rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL); } @@ -31,6 +31,46 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { } } +static bool skip_caps = false; + +static void fn_light(uint32_t state) { + if (IS_LAYER_ON_STATE(state, L_FN)) { + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_sethsv_noeeprom(modern_dolch_red.h, modern_dolch_red.s, rgblight_get_val()); + skip_caps = true; + } else { + rgblight_config_t saved = { .raw = eeconfig_read_rgblight() }; + rgblight_sethsv_noeeprom(saved.hue, saved.sat, saved.val); + rgblight_mode_noeeprom(saved.mode); + } + // caps_light will be called automatically after this +} + +static void caps_light(uint8_t usb_led) { + if (skip_caps) { + skip_caps = false; + return; // Skip calls triggered by the Fn layer turning on + } + if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_sethsv_noeeprom(modern_dolch_cyan.h, modern_dolch_cyan.s, rgblight_get_val()); + } else { + fn_light(layer_state); // Caps is off, check if Fn light should be on + } +} + +uint32_t layer_state_set_keymap(uint32_t state) { + static uint32_t prev_state = L_BASE; + if (IS_LAYER_ON_STATE(state, L_FN) != IS_LAYER_ON_STATE(prev_state, L_FN)) { + fn_light(state); // Fn state changed since last time + } + return prev_state = state; +} + +void led_set_keymap(uint8_t usb_led) { + caps_light(usb_led); +} + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base layer * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk b/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk index f7cf0758b7..7262c6db66 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk @@ -1,11 +1,11 @@ -BOOTMAGIC_ENABLE = no -COMMAND_ENABLE = yes -CONSOLE_ENABLE = no -EXTRAKEY_ENABLE = yes -MOUSEKEY_ENABLE = yes -NKRO_ENABLE = yes -TAP_DANCE_ENABLE = yes -UNICODEMAP_ENABLE = no - -BACKLIGHT_ENABLE = yes -RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = no +BOOTMAGIC_ENABLE = no +COMMAND_ENABLE = yes +CONSOLE_ENABLE = yes +EXTRAKEY_ENABLE = yes +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +RGBLIGHT_ENABLE = yes +SPACE_CADET_ENABLE = no +TAP_DANCE_ENABLE = yes +UNICODEMAP_ENABLE = no |