summaryrefslogtreecommitdiff
path: root/keyboards/moonlander/moonlander.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/moonlander/moonlander.c')
-rw-r--r--keyboards/moonlander/moonlander.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c
index 403e6aef8b..39f61b5c40 100644
--- a/keyboards/moonlander/moonlander.c
+++ b/keyboards/moonlander/moonlander.c
@@ -1,6 +1,6 @@
/* Copyright 2020 ZSA Technology Labs, Inc <@zsa>
* Copyright 2020 Jack Humbert <jack.humb@gmail.com>
- * Copyright 2020 Drashna Jael're <drashna@live.com>
+ * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -159,10 +159,10 @@ void keyboard_pre_init_kb(void) {
keyboard_pre_init_user();
}
-#ifdef ORYX_CONFIGURATOR
+#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);
@@ -415,6 +415,24 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!record->event.pressed && !webusb_state.pairing) 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) {
@@ -449,6 +467,11 @@ 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);
@@ -461,6 +484,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();
}