1 #ifndef PROCESS_TAP_DANCE_H
2 #define PROCESS_TAP_DANCE_H
4 #ifdef TAP_DANCE_ENABLE
14 } qk_tap_dance_state_t;
16 #define TD(n) (QK_TAP_DANCE + n)
20 QK_TAP_DANCE_TYPE_PAIR,
22 } qk_tap_dance_type_t;
24 typedef void (*qk_tap_dance_user_fn_t) (qk_tap_dance_state_t *state);
25 typedef void (*qk_tap_dance_user_fn_reset_t) (void);
29 qk_tap_dance_type_t type;
36 qk_tap_dance_user_fn_t regular;
37 qk_tap_dance_user_fn_t anyway;
38 qk_tap_dance_user_fn_reset_t reset;
41 } qk_tap_dance_action_t;
43 #define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) { \
44 .type = QK_TAP_DANCE_TYPE_PAIR, \
45 .pair = { kc1, kc2 } \
48 #define ACTION_TAP_DANCE_FN(user_fn) { \
49 .type = QK_TAP_DANCE_TYPE_FN, \
50 .fn = { user_fn, NULL, NULL } \
53 #define ACTION_TAP_DANCE_FN_ANYWAY(user_fn, user_fn_anyway) { \
54 .type = QK_TAP_DANCE_TYPE_FN, \
55 .fn = { user_fn, user_fn_anyway, NULL } \
58 #define ACTION_TAP_DANCE_FN_RESET(user_fn, user_fn_reset) { \
59 .type = QK_TAP_DANCE_TYPE_FN, \
60 .fn = { user_fn, NULL, user_fn_reset } \
63 #define ACTION_TAP_DANCE_FN_ANYWAY_RESET(user_fn, user_fn_anyway, user_fn_reset) { \
64 .type = QK_TAP_DANCE_TYPE_FN, \
65 .fn = { user_fn, user_fn_anyway, user_fn_reset } \
68 extern const qk_tap_dance_action_t tap_dance_actions[];
70 /* To be used internally */
72 bool process_tap_dance(uint16_t keycode, keyrecord_t *record);
73 void matrix_scan_tap_dance (void);
74 void reset_tap_dance (qk_tap_dance_state_t *state);