From fa000203ccf5206f0596cd25c6922dba269ad78b Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Fri, 20 Sep 2024 17:28:34 +0200 Subject: [PATCH] consolidate more code, left top column resets --- common/config.h | 8 ++++++++ common/keymap.h | 41 ++++++++++++++++++++++++++++++++++++++++- crkbd/config.h | 19 ------------------- crkbd/keymap.c | 40 ---------------------------------------- planck/config.h | 19 ------------------- planck/keymap.c | 40 ---------------------------------------- 6 files changed, 48 insertions(+), 119 deletions(-) diff --git a/common/config.h b/common/config.h index ab4aea0..2adbb2b 100644 --- a/common/config.h +++ b/common/config.h @@ -46,4 +46,12 @@ // delay hold/release to not mess up software #define TAP_CODE_DELAY 10 +// +// underglow configuration +// +// no lights if we sleep +#define RGBLIGHT_SLEEP + +// the modes we do use for lights +#define RGBLIGHT_EFFECT_BREATHING diff --git a/common/keymap.h b/common/keymap.h index ec6ba5d..ef49bf5 100644 --- a/common/keymap.h +++ b/common/keymap.h @@ -27,7 +27,7 @@ enum my_layers { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BASE] = LAYOUT( - TO(_BASE), KC_V, KC_L, KC_H, KC_K, KC_Q, KC_J, KC_F, KC_O, KC_U, KC_COMM, KC_PSCR, + QK_RBT, KC_V, KC_L, KC_H, KC_K, KC_Q, KC_J, KC_F, KC_O, KC_U, KC_COMM, KC_PSCR, XXXXXXX, RALT_T(KC_S), LALT_T(KC_R), LCTL_T(KC_N), LSFT_T(KC_T), KC_W, KC_Y, RSFT_T(KC_C), RCTL_T(KC_A), LALT_T(KC_E), RALT_T(KC_I), XXXXXXX, XXXXXXX, KC_Z, KC_X, KC_M, LGUI_T(KC_D), KC_B, KC_P, RGUI_T(KC_G), KC_QUOT, KC_SCLN, KC_DOT, XXXXXXX, MO(_SYM), KC_SPC, MO(_NUM), MO(_NAV), KC_BSPC, MO(_FN) @@ -83,3 +83,42 @@ bool achordion_chord(uint16_t tap_hold_keycode, on_left_hand(other_record->event.key); } +void keyboard_post_init_user(void) { + // always use the same effect + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING); + rgblight_set_speed_noeeprom(2); + + // trigger init of layer state + layer_state_set_user(layer_state); +} + +// handle layer changes for backlight +layer_state_t layer_state_set_user(layer_state_t state) { + const uint8_t layer = get_highest_layer(state); + switch (layer) { + case _BASE: + rgblight_sethsv_noeeprom(HSV_WHITE); + break; + + case _SYM: + rgblight_sethsv_noeeprom(HSV_RED); + break; + + case _NUM: + rgblight_sethsv_noeeprom(HSV_GREEN); + break; + + case _FN: + rgblight_sethsv_noeeprom(HSV_BLUE); + break; + + case _NAV: + rgblight_sethsv_noeeprom(HSV_GOLD); + break; + + default: + break; + } + + return state; +} diff --git a/crkbd/config.h b/crkbd/config.h index 87f7005..ac17ea4 100644 --- a/crkbd/config.h +++ b/crkbd/config.h @@ -21,22 +21,3 @@ // select hand configuration #define SPLIT_USB_DETECT - -// -// underglow configuration -// - -// no lights if we sleep -#define RGBLIGHT_SLEEP - -// more modes for lights -#define RGBLIGHT_EFFECT_ALTERNATING -#define RGBLIGHT_EFFECT_BREATHING -#define RGBLIGHT_EFFECT_CHRISTMAS -#define RGBLIGHT_EFFECT_KNIGHT -#define RGBLIGHT_EFFECT_RAINBOW_MOOD -#define RGBLIGHT_EFFECT_RAINBOW_SWIRL -#define RGBLIGHT_EFFECT_RGB_TEST -#define RGBLIGHT_EFFECT_SNAKE -#define RGBLIGHT_EFFECT_STATIC_GRADIENT -#define RGBLIGHT_EFFECT_TWINKLE diff --git a/crkbd/keymap.c b/crkbd/keymap.c index efeb439..52a1ec0 100644 --- a/crkbd/keymap.c +++ b/crkbd/keymap.c @@ -39,43 +39,3 @@ K24, K25, K26, K27, K28, K29, K30, K31, K32, K33, K34, K35 // our shared 42 keys keymap #include "../common/keymap.h" - -void keyboard_post_init_user(void) { - // always use the same effect - rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING); - rgblight_set_speed_noeeprom(2); - - // trigger init of layer state - layer_state_set_user(layer_state); -} - -// handle layer changes for backlight -layer_state_t layer_state_set_user(layer_state_t state) { - const uint8_t layer = get_highest_layer(state); - switch (layer) { - case _BASE: - rgblight_sethsv_noeeprom(HSV_WHITE); - break; - - case _SYM: - rgblight_sethsv_noeeprom(HSV_RED); - break; - - case _NUM: - rgblight_sethsv_noeeprom(HSV_GREEN); - break; - - case _FN: - rgblight_sethsv_noeeprom(HSV_BLUE); - break; - - case _NAV: - rgblight_sethsv_noeeprom(HSV_GOLD); - break; - - default: - break; - } - - return state; -} diff --git a/planck/config.h b/planck/config.h index 8e221a9..9093362 100644 --- a/planck/config.h +++ b/planck/config.h @@ -28,22 +28,3 @@ // normal startup sound #define STARTUP_SONG SONG(PLANCK_SOUND) - -// -// underglow configuration -// - -// no lights if we sleep -#define RGBLIGHT_SLEEP - -// more modes for lights -#define RGBLIGHT_EFFECT_ALTERNATING -#define RGBLIGHT_EFFECT_BREATHING -#define RGBLIGHT_EFFECT_CHRISTMAS -#define RGBLIGHT_EFFECT_KNIGHT -#define RGBLIGHT_EFFECT_RAINBOW_MOOD -#define RGBLIGHT_EFFECT_RAINBOW_SWIRL -#define RGBLIGHT_EFFECT_RGB_TEST -#define RGBLIGHT_EFFECT_SNAKE -#define RGBLIGHT_EFFECT_STATIC_GRADIENT -#define RGBLIGHT_EFFECT_TWINKLE diff --git a/planck/keymap.c b/planck/keymap.c index b0c2794..2666e77 100644 --- a/planck/keymap.c +++ b/planck/keymap.c @@ -39,43 +39,3 @@ KC_NO, KC_NO, KC_NO, K36, K37, K38, K39, K40, K41, KC_NO, KC_NO, KC_ // our shared 42 keys keymap #include "../common/keymap.h" - -void keyboard_post_init_user(void) { - // always use the same effect - rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING); - rgblight_set_speed_noeeprom(2); - - // trigger init of layer state - layer_state_set_user(layer_state); -} - -// handle layer changes for backlight -layer_state_t layer_state_set_user(layer_state_t state) { - const uint8_t layer = get_highest_layer(state); - switch (layer) { - case _BASE: - rgblight_sethsv_noeeprom(HSV_WHITE); - break; - - case _SYM: - rgblight_sethsv_noeeprom(HSV_RED); - break; - - case _NUM: - rgblight_sethsv_noeeprom(HSV_GREEN); - break; - - case _FN: - rgblight_sethsv_noeeprom(HSV_BLUE); - break; - - case _NAV: - rgblight_sethsv_noeeprom(HSV_GOLD); - break; - - default: - break; - } - - return state; -}