diff options
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.c')
| -rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 6e8e596673..fbe4ce1d33 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | static uint16_t active_td; | 18 | static uint16_t active_td; |
| 19 | static uint16_t last_tap_time; | 19 | static uint16_t last_tap_time; |
| 20 | 20 | ||
| 21 | void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data) { | 21 | void tap_dance_pair_on_each_tap(tap_dance_state_t *state, void *user_data) { |
| 22 | qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; | 22 | tap_dance_pair_t *pair = (tap_dance_pair_t *)user_data; |
| 23 | 23 | ||
| 24 | if (state->count == 2) { | 24 | if (state->count == 2) { |
| 25 | register_code16(pair->kc2); | 25 | register_code16(pair->kc2); |
| @@ -27,14 +27,14 @@ void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data) | |||
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data) { | 30 | void tap_dance_pair_finished(tap_dance_state_t *state, void *user_data) { |
| 31 | qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; | 31 | tap_dance_pair_t *pair = (tap_dance_pair_t *)user_data; |
| 32 | 32 | ||
| 33 | register_code16(pair->kc1); | 33 | register_code16(pair->kc1); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) { | 36 | void tap_dance_pair_reset(tap_dance_state_t *state, void *user_data) { |
| 37 | qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; | 37 | tap_dance_pair_t *pair = (tap_dance_pair_t *)user_data; |
| 38 | 38 | ||
| 39 | if (state->count == 1) { | 39 | if (state->count == 1) { |
| 40 | wait_ms(TAP_CODE_DELAY); | 40 | wait_ms(TAP_CODE_DELAY); |
| @@ -44,8 +44,8 @@ void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) { | |||
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void qk_tap_dance_dual_role_on_each_tap(qk_tap_dance_state_t *state, void *user_data) { | 47 | void tap_dance_dual_role_on_each_tap(tap_dance_state_t *state, void *user_data) { |
| 48 | qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data; | 48 | tap_dance_dual_role_t *pair = (tap_dance_dual_role_t *)user_data; |
| 49 | 49 | ||
| 50 | if (state->count == 2) { | 50 | if (state->count == 2) { |
| 51 | layer_move(pair->layer); | 51 | layer_move(pair->layer); |
| @@ -53,8 +53,8 @@ void qk_tap_dance_dual_role_on_each_tap(qk_tap_dance_state_t *state, void *user_ | |||
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void qk_tap_dance_dual_role_finished(qk_tap_dance_state_t *state, void *user_data) { | 56 | void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data) { |
| 57 | qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data; | 57 | tap_dance_dual_role_t *pair = (tap_dance_dual_role_t *)user_data; |
| 58 | 58 | ||
| 59 | if (state->count == 1) { | 59 | if (state->count == 1) { |
| 60 | register_code16(pair->kc); | 60 | register_code16(pair->kc); |
| @@ -63,8 +63,8 @@ void qk_tap_dance_dual_role_finished(qk_tap_dance_state_t *state, void *user_dat | |||
| 63 | } | 63 | } |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data) { | 66 | void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data) { |
| 67 | qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data; | 67 | tap_dance_dual_role_t *pair = (tap_dance_dual_role_t *)user_data; |
| 68 | 68 | ||
| 69 | if (state->count == 1) { | 69 | if (state->count == 1) { |
| 70 | wait_ms(TAP_CODE_DELAY); | 70 | wait_ms(TAP_CODE_DELAY); |
| @@ -72,13 +72,13 @@ void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data) | |||
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static inline void _process_tap_dance_action_fn(qk_tap_dance_state_t *state, void *user_data, qk_tap_dance_user_fn_t fn) { | 75 | static inline void _process_tap_dance_action_fn(tap_dance_state_t *state, void *user_data, tap_dance_user_fn_t fn) { |
| 76 | if (fn) { | 76 | if (fn) { |
| 77 | fn(state, user_data); | 77 | fn(state, user_data); |
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) { | 81 | static inline void process_tap_dance_action_on_each_tap(tap_dance_action_t *action) { |
| 82 | action->state.count++; | 82 | action->state.count++; |
| 83 | action->state.weak_mods = get_mods(); | 83 | action->state.weak_mods = get_mods(); |
| 84 | action->state.weak_mods |= get_weak_mods(); | 84 | action->state.weak_mods |= get_weak_mods(); |
| @@ -88,17 +88,17 @@ static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *a | |||
| 88 | _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); | 88 | _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | static inline void process_tap_dance_action_on_reset(qk_tap_dance_action_t *action) { | 91 | static inline void process_tap_dance_action_on_reset(tap_dance_action_t *action) { |
| 92 | _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_reset); | 92 | _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_reset); |
| 93 | del_weak_mods(action->state.weak_mods); | 93 | del_weak_mods(action->state.weak_mods); |
| 94 | #ifndef NO_ACTION_ONESHOT | 94 | #ifndef NO_ACTION_ONESHOT |
| 95 | del_mods(action->state.oneshot_mods); | 95 | del_mods(action->state.oneshot_mods); |
| 96 | #endif | 96 | #endif |
| 97 | send_keyboard_report(); | 97 | send_keyboard_report(); |
| 98 | action->state = (const qk_tap_dance_state_t){0}; | 98 | action->state = (const tap_dance_state_t){0}; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) { | 101 | static inline void process_tap_dance_action_on_dance_finished(tap_dance_action_t *action) { |
| 102 | if (!action->state.finished) { | 102 | if (!action->state.finished) { |
| 103 | action->state.finished = true; | 103 | action->state.finished = true; |
| 104 | add_weak_mods(action->state.weak_mods); | 104 | add_weak_mods(action->state.weak_mods); |
| @@ -116,7 +116,7 @@ static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_actio | |||
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) { | 118 | bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) { |
| 119 | qk_tap_dance_action_t *action; | 119 | tap_dance_action_t *action; |
| 120 | 120 | ||
| 121 | if (!record->event.pressed) return false; | 121 | if (!record->event.pressed) return false; |
| 122 | 122 | ||
| @@ -139,7 +139,7 @@ bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | 141 | bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { |
| 142 | qk_tap_dance_action_t *action; | 142 | tap_dance_action_t *action; |
| 143 | 143 | ||
| 144 | switch (keycode) { | 144 | switch (keycode) { |
| 145 | case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: | 145 | case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: |
| @@ -163,7 +163,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | void tap_dance_task() { | 165 | void tap_dance_task() { |
| 166 | qk_tap_dance_action_t *action; | 166 | tap_dance_action_t *action; |
| 167 | 167 | ||
| 168 | if (!active_td || timer_elapsed(last_tap_time) <= GET_TAPPING_TERM(active_td, &(keyrecord_t){})) return; | 168 | if (!active_td || timer_elapsed(last_tap_time) <= GET_TAPPING_TERM(active_td, &(keyrecord_t){})) return; |
| 169 | 169 | ||
| @@ -173,7 +173,7 @@ void tap_dance_task() { | |||
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | void reset_tap_dance(qk_tap_dance_state_t *state) { | 176 | void reset_tap_dance(tap_dance_state_t *state) { |
| 177 | active_td = 0; | 177 | active_td = 0; |
| 178 | process_tap_dance_action_on_reset((qk_tap_dance_action_t *)state); | 178 | process_tap_dance_action_on_reset((tap_dance_action_t *)state); |
| 179 | } | 179 | } |
