summaryrefslogtreecommitdiffstats
path: root/keyboards/moonlander/moonlander.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-10-13 04:35:36 -0700
committerGitHub <noreply@github.com>2020-10-13 04:35:36 -0700
commit2a65709db6b6154b6780b70b26de57d8d9a63749 (patch)
treefb79b2928adcde4b41df8062060982bb03e4d806 /keyboards/moonlander/moonlander.c
parent451e600476d72b6f595044844b8a6767246de5ce (diff)
[Keyboard] Update to ZSA Boards (#10119)
* Add VID/PIDs to ErgoDox EZ * Add VID/PIDs for Planck EZ and Glow revision * Make names consistent * fix typo in docs * Move LED config back, for maximum compatibility * Add revisions for ErgoDox EZ boards * Fix embarassing typo * Typooooo Co-authored-by: Nick Brassel <nick@tzarc.org> * Update Licensing info * Update Moonlander default keymap to match Oryx's default * Fix formatting based on suggestions Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * Make indicator LEDs more configurable * Update default keymap * Handle older eeprom settings Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
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();
}