diff options
| author | Ryan <fauxpark@gmail.com> | 2023-07-11 17:07:24 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-11 17:07:24 +1000 |
| commit | eee0384167b965c60120e1222bc24c0b40cadac4 (patch) | |
| tree | 9ff4859ab0727091177d7d6a99c54cca9d6b93f0 /quantum/process_keycode/process_tap_dance.h | |
| parent | 39a97d2ee43d00e87a9f94971093863a864cbffd (diff) | |
process_keycode: remove direct `quantum.h` includes (#21486)
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.h')
| -rw-r--r-- | quantum/process_keycode/process_tap_dance.h | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index 5cb6d9202c..386f504619 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h | |||
| @@ -16,18 +16,17 @@ | |||
| 16 | 16 | ||
| 17 | #pragma once | 17 | #pragma once |
| 18 | 18 | ||
| 19 | #ifdef TAP_DANCE_ENABLE | 19 | #include <stdint.h> |
| 20 | 20 | #include <stdbool.h> | |
| 21 | # include <stdbool.h> | 21 | #include "action.h" |
| 22 | # include <inttypes.h> | ||
| 23 | 22 | ||
| 24 | typedef struct { | 23 | typedef struct { |
| 25 | uint16_t interrupting_keycode; | 24 | uint16_t interrupting_keycode; |
| 26 | uint8_t count; | 25 | uint8_t count; |
| 27 | uint8_t weak_mods; | 26 | uint8_t weak_mods; |
| 28 | # ifndef NO_ACTION_ONESHOT | 27 | #ifndef NO_ACTION_ONESHOT |
| 29 | uint8_t oneshot_mods; | 28 | uint8_t oneshot_mods; |
| 30 | # endif | 29 | #endif |
| 31 | bool pressed : 1; | 30 | bool pressed : 1; |
| 32 | bool finished : 1; | 31 | bool finished : 1; |
| 33 | bool interrupted : 1; | 32 | bool interrupted : 1; |
| @@ -56,24 +55,24 @@ typedef struct { | |||
| 56 | void (*layer_function)(uint8_t); | 55 | void (*layer_function)(uint8_t); |
| 57 | } tap_dance_dual_role_t; | 56 | } tap_dance_dual_role_t; |
| 58 | 57 | ||
| 59 | # define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ | 58 | #define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ |
| 60 | { .fn = {tap_dance_pair_on_each_tap, tap_dance_pair_finished, tap_dance_pair_reset}, .user_data = (void *)&((tap_dance_pair_t){kc1, kc2}), } | 59 | { .fn = {tap_dance_pair_on_each_tap, tap_dance_pair_finished, tap_dance_pair_reset}, .user_data = (void *)&((tap_dance_pair_t){kc1, kc2}), } |
| 61 | 60 | ||
| 62 | # define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \ | 61 | #define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \ |
| 63 | { .fn = {tap_dance_dual_role_on_each_tap, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_move}), } | 62 | { .fn = {tap_dance_dual_role_on_each_tap, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_move}), } |
| 64 | 63 | ||
| 65 | # define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \ | 64 | #define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \ |
| 66 | { .fn = {NULL, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_invert}), } | 65 | { .fn = {NULL, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_invert}), } |
| 67 | 66 | ||
| 68 | # define ACTION_TAP_DANCE_FN(user_fn) \ | 67 | #define ACTION_TAP_DANCE_FN(user_fn) \ |
| 69 | { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } | 68 | { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } |
| 70 | 69 | ||
| 71 | # define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) \ | 70 | #define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) \ |
| 72 | { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, } | 71 | { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, } |
| 73 | 72 | ||
| 74 | # define TD(n) (QK_TAP_DANCE | TD_INDEX(n)) | 73 | #define TD(n) (QK_TAP_DANCE | TD_INDEX(n)) |
| 75 | # define TD_INDEX(code) ((code)&0xFF) | 74 | #define TD_INDEX(code) ((code)&0xFF) |
| 76 | # define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions) | 75 | #define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions) |
| 77 | 76 | ||
| 78 | extern tap_dance_action_t tap_dance_actions[]; | 77 | extern tap_dance_action_t tap_dance_actions[]; |
| 79 | 78 | ||
| @@ -92,9 +91,3 @@ void tap_dance_pair_reset(tap_dance_state_t *state, void *user_data); | |||
| 92 | void tap_dance_dual_role_on_each_tap(tap_dance_state_t *state, void *user_data); | 91 | void tap_dance_dual_role_on_each_tap(tap_dance_state_t *state, void *user_data); |
| 93 | void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data); | 92 | void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data); |
| 94 | void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data); | 93 | void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data); |
| 95 | |||
| 96 | #else | ||
| 97 | |||
| 98 | # define TD(n) KC_NO | ||
| 99 | |||
| 100 | #endif | ||
