diff options
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.h')
| -rw-r--r-- | quantum/process_keycode/process_tap_dance.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index d6d6c136dc..5cb6d9202c 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h | |||
| @@ -31,39 +31,39 @@ typedef struct { | |||
| 31 | bool pressed : 1; | 31 | bool pressed : 1; |
| 32 | bool finished : 1; | 32 | bool finished : 1; |
| 33 | bool interrupted : 1; | 33 | bool interrupted : 1; |
| 34 | } qk_tap_dance_state_t; | 34 | } tap_dance_state_t; |
| 35 | 35 | ||
| 36 | typedef void (*qk_tap_dance_user_fn_t)(qk_tap_dance_state_t *state, void *user_data); | 36 | typedef void (*tap_dance_user_fn_t)(tap_dance_state_t *state, void *user_data); |
| 37 | 37 | ||
| 38 | typedef struct { | 38 | typedef struct { |
| 39 | qk_tap_dance_state_t state; | 39 | tap_dance_state_t state; |
| 40 | struct { | 40 | struct { |
| 41 | qk_tap_dance_user_fn_t on_each_tap; | 41 | tap_dance_user_fn_t on_each_tap; |
| 42 | qk_tap_dance_user_fn_t on_dance_finished; | 42 | tap_dance_user_fn_t on_dance_finished; |
| 43 | qk_tap_dance_user_fn_t on_reset; | 43 | tap_dance_user_fn_t on_reset; |
| 44 | } fn; | 44 | } fn; |
| 45 | void *user_data; | 45 | void *user_data; |
| 46 | } qk_tap_dance_action_t; | 46 | } tap_dance_action_t; |
| 47 | 47 | ||
| 48 | typedef struct { | 48 | typedef struct { |
| 49 | uint16_t kc1; | 49 | uint16_t kc1; |
| 50 | uint16_t kc2; | 50 | uint16_t kc2; |
| 51 | } qk_tap_dance_pair_t; | 51 | } tap_dance_pair_t; |
| 52 | 52 | ||
| 53 | typedef struct { | 53 | typedef struct { |
| 54 | uint16_t kc; | 54 | uint16_t kc; |
| 55 | uint8_t layer; | 55 | uint8_t layer; |
| 56 | void (*layer_function)(uint8_t); | 56 | void (*layer_function)(uint8_t); |
| 57 | } qk_tap_dance_dual_role_t; | 57 | } tap_dance_dual_role_t; |
| 58 | 58 | ||
| 59 | # define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ | 59 | # define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ |
| 60 | { .fn = {qk_tap_dance_pair_on_each_tap, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset}, .user_data = (void *)&((qk_tap_dance_pair_t){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}), } |
| 61 | 61 | ||
| 62 | # define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \ | 62 | # define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \ |
| 63 | { .fn = {qk_tap_dance_dual_role_on_each_tap, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset}, .user_data = (void *)&((qk_tap_dance_dual_role_t){kc, layer, layer_move}), } | 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}), } |
| 64 | 64 | ||
| 65 | # define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \ | 65 | # define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \ |
| 66 | { .fn = {NULL, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset}, .user_data = (void *)&((qk_tap_dance_dual_role_t){kc, layer, layer_invert}), } | 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}), } |
| 67 | 67 | ||
| 68 | # define ACTION_TAP_DANCE_FN(user_fn) \ | 68 | # define ACTION_TAP_DANCE_FN(user_fn) \ |
| 69 | { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } | 69 | { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } |
| @@ -73,11 +73,11 @@ typedef struct { | |||
| 73 | 73 | ||
| 74 | # define TD(n) (QK_TAP_DANCE | TD_INDEX(n)) | 74 | # define TD(n) (QK_TAP_DANCE | TD_INDEX(n)) |
| 75 | # define TD_INDEX(code) ((code)&0xFF) | 75 | # define TD_INDEX(code) ((code)&0xFF) |
| 76 | # define TAP_DANCE_KEYCODE(state) TD(((qk_tap_dance_action_t *)state) - tap_dance_actions) | 76 | # define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions) |
| 77 | 77 | ||
| 78 | extern qk_tap_dance_action_t tap_dance_actions[]; | 78 | extern tap_dance_action_t tap_dance_actions[]; |
| 79 | 79 | ||
| 80 | void reset_tap_dance(qk_tap_dance_state_t *state); | 80 | void reset_tap_dance(tap_dance_state_t *state); |
| 81 | 81 | ||
| 82 | /* To be used internally */ | 82 | /* To be used internally */ |
| 83 | 83 | ||
| @@ -85,13 +85,13 @@ bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record); | |||
| 85 | bool process_tap_dance(uint16_t keycode, keyrecord_t *record); | 85 | bool process_tap_dance(uint16_t keycode, keyrecord_t *record); |
| 86 | void tap_dance_task(void); | 86 | void tap_dance_task(void); |
| 87 | 87 | ||
| 88 | void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data); | 88 | void tap_dance_pair_on_each_tap(tap_dance_state_t *state, void *user_data); |
| 89 | void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data); | 89 | void tap_dance_pair_finished(tap_dance_state_t *state, void *user_data); |
| 90 | void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data); | 90 | void tap_dance_pair_reset(tap_dance_state_t *state, void *user_data); |
| 91 | 91 | ||
| 92 | void qk_tap_dance_dual_role_on_each_tap(qk_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); |
| 93 | void qk_tap_dance_dual_role_finished(qk_tap_dance_state_t *state, void *user_data); | 93 | void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data); |
| 94 | void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data); | 94 | void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data); |
| 95 | 95 | ||
| 96 | #else | 96 | #else |
| 97 | 97 | ||
