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

Add direction to dynamic_macro_record_start_user #19689

Merged
merged 1 commit into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/feature_dynamic_macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ There are a number of hooks that you can use to add custom functionality and fee

Note, that direction indicates which macro it is, with `1` being Macro 1, `-1` being Macro 2, and 0 being no macro.

* `dynamic_macro_record_start_user(void)` - Triggered when you start recording a macro.
* `dynamic_macro_record_start_user(int8_t direction)` - Triggered when you start recording a macro.
drashna marked this conversation as resolved.
Show resolved Hide resolved
* `dynamic_macro_play_user(int8_t direction)` - Triggered when you play back a macro.
* `dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record)` - Triggered on each keypress while recording a macro.
* `dynamic_macro_record_end_user(int8_t direction)` - Triggered when the macro recording is stopped.
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/feature_dynamic_macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ QMK はその場で作られた一時的なマクロをサポートします。

direction がどのマクロであるかを示すことに注意してください。`1` がマクロ 1、`-1` がマクロ 2、0 がマクロ無しです。

* `dynamic_macro_record_start_user(void)` - マクロの記録を開始する時に起動されます。
* `dynamic_macro_record_start_user(int8_t direction)` - マクロの記録を開始する時に起動されます。
* `dynamic_macro_play_user(int8_t direction)` - マクロを再生する時に起動されます。
* `dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record)` - マクロの記録中に各キー押下で起動されます。
* `dynamic_macro_record_end_user(int8_t direction)` - マクロの記録を停止した時に起動されます。
Expand Down
2 changes: 1 addition & 1 deletion keyboards/40percentclub/mf68/keymaps/delivrance/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void led_blink(void) {
backlight_toggle();
}

void dynamic_macro_record_start_user(void) {
void dynamic_macro_record_start_user(int8_t direction) {
led_blink();
}

Expand Down
2 changes: 1 addition & 1 deletion keyboards/dztech/dz65rgb/keymaps/drootz/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ void leader_end_user(void) {

/**************** DYNAMIC MACRO *********************/

void dynamic_macro_record_start_user(void) {
void dynamic_macro_record_start_user(int8_t direction) {
onMac = false; /* reset layer bool as dynamic macro clear the keyboard and reset layers. */
if (!isBlinking && !isRecording) {
reset_blink_cycle();
Expand Down
2 changes: 1 addition & 1 deletion keyboards/ergodox_ez/ergodox_ez.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static bool is_on = false;
static bool is_dynamic_recording = false;
static uint16_t dynamic_loop_timer;

void dynamic_macro_record_start_user(void) {
void dynamic_macro_record_start_user(int8_t direction) {
is_dynamic_recording = true;
dynamic_loop_timer = timer_read();
ergodox_right_led_1_on();
Expand Down
2 changes: 1 addition & 1 deletion keyboards/gmmk/pro/rev1/ansi/keymaps/mattgauf/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ bool rgb_matrix_indicators_user(void) {


// Called on start
void dynamic_macro_record_start_user(void) {
void dynamic_macro_record_start_user(int8_t direction) {
dprint("-- Recording Started\n");
layer_on(_UTILITY);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}

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

Expand Down
2 changes: 1 addition & 1 deletion keyboards/kprepublic/bm40hsrgb/keymaps/coffee/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum layout_names {
static uint16_t REC = DM_REC1;
static uint16_t PLY = DM_PLY1;

void dynamic_macro_record_start_user(void) {
void dynamic_macro_record_start_user(int8_t direction) {
REC = DM_RSTP;
RECORDING = true;
}
Expand Down
2 changes: 1 addition & 1 deletion keyboards/moonlander/moonlander.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bool is_launching = false;
#ifdef DYNAMIC_MACRO_ENABLE
static bool is_dynamic_recording = false;

void dynamic_macro_record_start_user(void) { is_dynamic_recording = true; }
void dynamic_macro_record_start_user(int8_t direction) { is_dynamic_recording = true; }

void dynamic_macro_record_end_user(int8_t direction) {
is_dynamic_recording = false;
Expand Down
2 changes: 1 addition & 1 deletion keyboards/mschwingen/modelm/modelm.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void update_layer_leds(void) {

#endif

void dynamic_macro_record_start_user(void) {
void dynamic_macro_record_start_user(int8_t direction) {
isRecording++;
blink_cycle_timer = timer_read();
}
Expand Down
2 changes: 1 addition & 1 deletion keyboards/planck/keymaps/tk/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void keyboard_post_init_user(void) {

static bool prerecord_clicky = false;

void dynamic_macro_record_start_user(void) {
void dynamic_macro_record_start_user(int8_t direction) {
prerecord_clicky = is_clicky_on();
if (!prerecord_clicky) {
clicky_on();
Expand Down
10 changes: 5 additions & 5 deletions quantum/process_keycode/process_dynamic_macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void dynamic_macro_led_blink(void) {

/* User hooks for Dynamic Macros */

__attribute__((weak)) void dynamic_macro_record_start_user(void) {
__attribute__((weak)) void dynamic_macro_record_start_user(int8_t direction) {
dynamic_macro_led_blink();
}

Expand Down Expand Up @@ -62,10 +62,10 @@ __attribute__((weak)) bool dynamic_macro_valid_key_user(uint16_t keycode, keyrec
* @param[out] macro_pointer The new macro buffer iterator.
* @param[in] macro_buffer The macro buffer used to initialize macro_pointer.
*/
void dynamic_macro_record_start(keyrecord_t **macro_pointer, keyrecord_t *macro_buffer) {
void dynamic_macro_record_start(keyrecord_t **macro_pointer, keyrecord_t *macro_buffer, int8_t direction) {
dprintln("dynamic macro recording: started");

dynamic_macro_record_start_user();
dynamic_macro_record_start_user(direction);

clear_keyboard();
layer_clear();
Expand Down Expand Up @@ -213,11 +213,11 @@ bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
if (!record->event.pressed) {
switch (keycode) {
case QK_DYNAMIC_MACRO_RECORD_START_1:
dynamic_macro_record_start(&macro_pointer, macro_buffer);
dynamic_macro_record_start(&macro_pointer, macro_buffer, +1);
macro_id = 1;
return false;
case QK_DYNAMIC_MACRO_RECORD_START_2:
dynamic_macro_record_start(&macro_pointer, r_macro_buffer);
dynamic_macro_record_start(&macro_pointer, r_macro_buffer, -1);
macro_id = 2;
return false;
case QK_DYNAMIC_MACRO_PLAY_1:
Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_dynamic_macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

void dynamic_macro_led_blink(void);
bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record);
void dynamic_macro_record_start_user(void);
void dynamic_macro_record_start_user(int8_t direction);
void dynamic_macro_play_user(int8_t direction);
void dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record);
void dynamic_macro_record_end_user(int8_t direction);