Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keyboard] Update to ZSA Keyboards #15644

Merged
merged 12 commits into from
Dec 29, 2021
Prev Previous commit
Next Next commit
Adds caps lock led status on Moonlander/Ergodox (zsa#332)
* feat: adds caps lock led status on Moonlander/Ergodox

* fix: botched source file

* fix: light up the most right leds
  • Loading branch information
fdidron authored and drashna committed Dec 29, 2021
commit aa2c4bf56dd875876ddaace1e8462b6666956f2b
51 changes: 51 additions & 0 deletions keyboards/ergodox_ez/ergodox_ez.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,54 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset!
eeconfig_update_kb(keyboard_config.raw);
eeconfig_init_user();
}

#ifdef ORYX_ENABLE
static uint16_t loops = 0;
static bool is_on = false;
#endif

#ifdef DYNAMIC_MACRO_ENABLE
static bool is_dynamic_recording = false;
static uint16_t dynamic_loop_timer;

void dynamic_macro_record_start_user(void) {
is_dynamic_recording = true;
dynamic_loop_timer = timer_read();
ergodox_right_led_1_on();
}

void dynamic_macro_record_end_user(int8_t direction) {
is_dynamic_recording = false;
layer_state_set_user(layer_state);
}
#endif

void matrix_scan_kb(void) {
#ifdef DYNAMIC_MACRO_ENABLE
if (is_dynamic_recording) {
ergodox_right_led_1_off();
// if (timer_elapsed(dynamic_loop_timer) > 5)
{
static uint8_t counter;
counter++;
if (counter > 100) ergodox_right_led_1_on();
dynamic_loop_timer = timer_read();
}
}
#endif

#ifdef CAPS_LOCK_STATUS
led_t led_state = host_keyboard_led_state();
if(led_state.caps_lock) {
ergodox_right_led_3_on();
}
else {
uint8_t layer = get_highest_layer(layer_state);
if(layer != 1) {
ergodox_right_led_3_off();
}
}
#endif

matrix_scan_user();
}
14 changes: 14 additions & 0 deletions keyboards/moonlander/moonlander.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,20 @@ void moonlander_led_task(void) {
wait_ms(150);
}
#endif
#ifdef CAPS_LOCK_STATUS
else {
led_t led_state = host_keyboard_led_state();
if(led_state.caps_lock) {
ML_LED_6(true);
}
else {
uint8_t layer = get_highest_layer(layer_state);
if(layer != 1) {
ML_LED_6(false);
}
}
}
#endif
}

static THD_WORKING_AREA(waLEDThread, 128);
Expand Down