diff --git a/crkbd/config.h b/crkbd/config.h index 970f7c4..5e04ca4 100644 --- a/crkbd/config.h +++ b/crkbd/config.h @@ -29,22 +29,21 @@ along with this program. If not, see . // #define MASTER_RIGHT // #define EE_HANDS -//#define QUICK_TAP_TERM 0 -//#define TAPPING_TERM 100 +// +// underglow configuration +// -#ifdef RGBLIGHT_ENABLE - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_RAINBOW_MOOD - #define RGBLIGHT_EFFECT_RAINBOW_SWIRL - #define RGBLIGHT_EFFECT_SNAKE - #define RGBLIGHT_EFFECT_KNIGHT - #define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - #define RGBLIGHT_EFFECT_RGB_TEST - #define RGBLIGHT_EFFECT_ALTERNATING - #define RGBLIGHT_EFFECT_TWINKLE - #define RGBLIGHT_LIMIT_VAL 120 - #define RGBLIGHT_HUE_STEP 10 - #define RGBLIGHT_SAT_STEP 17 - #define RGBLIGHT_VAL_STEP 17 -#endif +// 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 d6cae2d..60aad99 100644 --- a/crkbd/keymap.c +++ b/crkbd/keymap.c @@ -41,3 +41,43 @@ 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; +}