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

Dynamic macro callbacks #24142

Merged
merged 7 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update keyboard/keymap functions to match
  • Loading branch information
drashna committed Jul 18, 2024
commit 7c2b4bfb72590a1c4369fe647e562c3ac15a89fb
12 changes: 10 additions & 2 deletions keyboards/ergodox_ez/ergodox_ez.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,23 @@ static bool is_on = false;
static bool is_dynamic_recording = false;
static uint16_t dynamic_loop_timer;

void dynamic_macro_record_start_user(int8_t direction) {
bool dynamic_macro_record_start_kb(int8_t direction) {
if (!dynamic_macro_record_start_user(direction)) {
return false;
}
is_dynamic_recording = true;
dynamic_loop_timer = timer_read();
ergodox_right_led_1_on();
return true;
}

void dynamic_macro_record_end_user(int8_t direction) {
bool dynamic_macro_record_end_kb(int8_t direction) {
if (!dynamic_macro_record_end_user(direction)) {
return false;
}
is_dynamic_recording = false;
layer_state_set_user(layer_state);
return true;
}
#endif

Expand Down
6 changes: 4 additions & 2 deletions keyboards/handwired/dactyl_minidox/keymaps/dlford/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,14 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}

// Dynamic Macro Recording Backlight
void dynamic_macro_record_start_user(int8_t direction) {
bool dynamic_macro_record_start_user(int8_t direction) {
is_macro_recording = true;
return true;
}

void dynamic_macro_record_end_user(int8_t direction) {
bool dynamic_macro_record_end_user(int8_t direction) {
is_macro_recording = false;
return true;
}

// Indicators
Expand Down
12 changes: 10 additions & 2 deletions keyboards/ibm/model_m/mschwingen/mschwingen.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,19 @@ void update_layer_leds(void) {

#endif

void dynamic_macro_record_start_user(int8_t direction) {
bool dynamic_macro_record_start_kb(int8_t direction) {
if (!dynamic_macro_record_start_user(direction)) {
return false;
}
isRecording++;
blink_cycle_timer = timer_read();
return true;
}

void dynamic_macro_record_end_user(int8_t direction) {
bool dynamic_macro_record_end_kb(int8_t direction) {
if (!dynamic_macro_record_end_user(direction)) {
return false;
}
if (isRecording) isRecording--;
return true
}
14 changes: 12 additions & 2 deletions keyboards/zsa/moonlander/moonlander.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ bool is_launching = false;
#ifdef DYNAMIC_MACRO_ENABLE
static bool is_dynamic_recording = false;

void dynamic_macro_record_start_user(int8_t direction) { is_dynamic_recording = true; }
bool dynamic_macro_record_start_kb(int8_t direction) {
if (!dynamic_macro_record_start_user(direction)) {
return false;
}
is_dynamic_recording = true;
return true;
}

void dynamic_macro_record_end_user(int8_t direction) {
bool dynamic_macro_record_end_kb(int8_t direction) {
if (!dynamic_macro_record_end_user(direction)) {
return false;
}
is_dynamic_recording = false;
ML_LED_3(false);
return false;
}
#endif

Expand Down
12 changes: 10 additions & 2 deletions keyboards/zsa/voyager/voyager.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,26 @@ static uint32_t dynamic_macro_led(uint32_t trigger_time, void *cb_arg) {
return 100;
}

void dynamic_macro_record_start_user(int8_t direction) {
bool dynamic_macro_record_start_kb(int8_t direction) {
if (!dynamic_macro_record_start_user(direction)) {
return false;
}
if (dynamic_macro_token == INVALID_DEFERRED_TOKEN) {
STATUS_LED_3(true);
dynamic_macro_token = defer_exec(100, dynamic_macro_led, NULL);
}
return true;
}

void dynamic_macro_record_end_user(int8_t direction) {
bool dynamic_macro_record_end_kb(int8_t direction) {
if (!dynamic_macro_record_end_user(direction)) {
return false;
}
if (cancel_deferred_exec(dynamic_macro_token)) {
dynamic_macro_token = INVALID_DEFERRED_TOKEN;
STATUS_LED_3(false);
}
return true;
}
# endif

Expand Down