summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2020-04-23 20:14:38 -0700
committerFlorian Didron <fdidron@users.noreply.github.com>2020-06-02 16:22:32 +0900
commitf6949c1eaca260731d4b01d931d5fcdeff1f06ab (patch)
tree106f56dd86958105d01a97dbbaa1708f6c173008
parent4f5daf452861f4c42d60fa8eb49bd8db0a7e29fa (diff)
Enable LED Blinking for Dynamic Macro Recording status for Ergodox EZ
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c
index d003a19946..5773d3e3e3 100644
--- a/keyboards/ergodox_ez/ergodox_ez.c
+++ b/keyboards/ergodox_ez/ergodox_ez.c
@@ -391,8 +391,26 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset!
#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 ORYX_ENABLE
if(webusb_state.pairing == true) {
if(loops == 0) {
ergodox_right_led_1_off();
@@ -402,8 +420,7 @@ void matrix_scan_kb(void) {
if(loops % WEBUSB_BLINK_STEPS == 0) {
if(is_on) {
ergodox_right_led_2_off();
- }
- else {
+ } else {
ergodox_right_led_2_on();
}
is_on ^= 1;
@@ -414,12 +431,24 @@ void matrix_scan_kb(void) {
loops = 0;
}
loops++;
+ } else if(loops > 0) {
+ loops = 0;
+ layer_state_set_user(layer_state);
}
- else if(loops > 0) {
- loops = 0;
- layer_state_set_user(layer_state);
+#endif
+
+#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
+
matrix_scan_user();
}
-
-#endif