diff options
author | Drashna Jael're <drashna@live.com> | 2020-09-30 04:32:30 -0700 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2020-09-30 04:32:30 -0700 |
commit | 454684a8bbf41860dc9331bfc671ab80d53bf51f (patch) | |
tree | 89b9e9a98ed6c0cd7d68ec3027b16255efd82b82 /keyboards/moonlander/moonlander.c | |
parent | 396b86b92d8010ac929f30768cc98643ea019986 (diff) |
[Keyboard] Update to ZSA Boards (qmk#10119)
Diffstat (limited to 'keyboards/moonlander/moonlander.c')
-rw-r--r-- | keyboards/moonlander/moonlander.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c index ee7a31b124..52cccc9727 100644 --- a/keyboards/moonlander/moonlander.c +++ b/keyboards/moonlander/moonlander.c @@ -161,9 +161,10 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } +#if !defined(MOONLANDER_USER_LEDS) layer_state_t layer_state_set_kb(layer_state_t state) { state = layer_state_set_user(state); - if (is_launching) return state; + if (is_launching || !keyboard_config.led_level) return state; ML_LED_1(false); ML_LED_2(false); @@ -201,6 +202,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) { return state; } +#endif #ifdef RGB_MATRIX_ENABLE // clang-format off @@ -417,6 +419,24 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { layer_state_set_kb(layer_state); break; #endif +#if !defined(MOONLANDER_USER_LEDS) + case LED_LEVEL: + if (record->event.pressed) { + keyboard_config.led_level ^= 1; + eeconfig_update_kb(keyboard_config.raw); + if (keyboard_config.led_level) { + layer_state_set_kb(layer_state); + } else { + ML_LED_1(false); + ML_LED_2(false); + ML_LED_3(false); + ML_LED_4(false); + ML_LED_5(false); + ML_LED_6(false); + } + } + break; +#endif #ifdef RGB_MATRIX_ENABLE case TOGGLE_LAYER_COLOR: if (record->event.pressed) { @@ -452,6 +472,12 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { void matrix_init_kb(void) { keyboard_config.raw = eeconfig_read_kb(); + if (!keyboard_config.led_level && !keyboard_config.led_level_res) { + keyboard_config.led_level = true; + keyboard_config.led_level_res = 0b11; + eeconfig_update_kb(keyboard_config.raw); + } + #ifdef RGB_MATRIX_ENABLE if (keyboard_config.rgb_matrix_enable) { rgb_matrix_set_flags(LED_FLAG_ALL); @@ -464,6 +490,8 @@ void matrix_init_kb(void) { void eeconfig_init_kb(void) { // EEPROM is getting reset! keyboard_config.raw = 0; keyboard_config.rgb_matrix_enable = true; + keyboard_config.led_level = true; + keyboard_config.led_level_res = 0b11; eeconfig_update_kb(keyboard_config.raw); eeconfig_init_user(); } |