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.c111
1 files changed, 41 insertions, 70 deletions
diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c
index d5105c26cd..ea50226f0c 100644
--- a/keyboards/moonlander/moonlander.c
+++ b/keyboards/moonlander/moonlander.c
@@ -19,9 +19,6 @@
#include "moonlander.h"
-#ifdef WEBUSB_ENABLE
-# include "webusb.h"
-#endif
keyboard_config_t keyboard_config;
@@ -83,50 +80,9 @@ void moonlander_led_task(void) {
wait_ms(155);
}
#endif
-#ifdef WEBUSB_ENABLE
- else if (webusb_state.pairing == true) {
- static uint8_t led_mask;
-
- ML_LED_1(false);
- ML_LED_2(false);
- ML_LED_3(false);
- ML_LED_4(false);
- ML_LED_5(false);
- ML_LED_6(false);
-
- if (!led_mask) {
- led_mask = 1;
- } else {
- led_mask++;
- if (led_mask > 12) led_mask = 1;
- }
- switch (led_mask) {
- case 1:
- case 12:
- ML_LED_1(true);
- break;
- case 2:
- case 11:
- ML_LED_2(true);
- break;
- case 3:
- case 10:
- ML_LED_3(true);
- break;
- case 4:
- case 9:
- ML_LED_4(true);
- break;
- case 5:
- case 8:
- ML_LED_5(true);
- break;
- case 6:
- case 7:
- ML_LED_6(true);
- break;
- }
- wait_ms(150);
+#if !defined(MOONLANDER_USER_LEDS)
+ else {
+ layer_state_set_kb(layer_state);
}
#endif
}
@@ -163,40 +119,53 @@ void keyboard_pre_init_kb(void) {
layer_state_t layer_state_set_kb(layer_state_t state) {
state = layer_state_set_user(state);
if (is_launching || !keyboard_config.led_level) return state;
-
- ML_LED_1(false);
- ML_LED_2(false);
- ML_LED_3(false);
- ML_LED_4(false);
- ML_LED_5(false);
- ML_LED_6(false);
+ bool LED_1 = false;
+ bool LED_2 = false;
+ bool LED_3 = false;
+ bool LED_4 = false;
+ bool LED_5 = false;
+ bool LED_6 = false;
uint8_t layer = get_highest_layer(state);
switch (layer) {
case 1:
- ML_LED_1(1);
- ML_LED_4(1);
+ LED_1 = true;
+ LED_4 = true;
break;
case 2:
- ML_LED_2(1);
- ML_LED_5(1);
+ LED_2 = true;
+ LED_5 = true;
break;
case 3:
- ML_LED_3(1);
+ LED_3 = true;
+#if !defined(CAPS_LOCK_STATUS)
+ LED_6 = true;
+#endif
break;
case 4:
- ML_LED_4(1);
+ LED_4 = true;
break;
case 5:
- ML_LED_5(1);
+ LED_5 = true;
break;
case 6:
- ML_LED_6(1);
+#if !defined(CAPS_LOCK_STATUS)
+ LED_6 = true;
+#endif
break;
default:
break;
}
+ ML_LED_1(LED_1);
+ ML_LED_2(LED_2);
+ ML_LED_3(LED_3);
+ ML_LED_4(LED_4);
+ ML_LED_5(LED_5);
+#if !defined(CAPS_LOCK_STATUS)
+ ML_LED_6(LED_6);
+#endif
+
return state;
}
#endif
@@ -398,15 +367,19 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = LAYOUT_moonlander(
// clang-format on
#endif
-#ifdef ORYX_CONFIGURATOR
+#ifdef CAPS_LOCK_STATUS
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ ML_LED_6(led_state.caps_lock);
+ }
+ return res;
+}
+#endif
+
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) { return false; }
switch (keycode) {
-#ifdef WEBUSB_ENABLE
- case WEBUSB_PAIR:
- 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) {
@@ -454,8 +427,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return true;
}
-#endif
-
void matrix_init_kb(void) {
keyboard_config.raw = eeconfig_read_kb();