diff options
Diffstat (limited to 'docs/features/tap_dance.md')
-rw-r--r-- | docs/features/tap_dance.md | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/docs/features/tap_dance.md b/docs/features/tap_dance.md index 8fdd83c18d..d533e41aaa 100644 --- a/docs/features/tap_dance.md +++ b/docs/features/tap_dance.md @@ -170,20 +170,6 @@ typedef struct { uint16_t held; } tap_dance_tap_hold_t; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - tap_dance_action_t *action; - - switch (keycode) { - case TD(CT_CLN): // list all tap dance keycodes with tap-hold configurations - action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(keycode)]; - if (!record->event.pressed && action->state.count && !action->state.finished) { - tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data; - tap_code16(tap_hold->tap); - } - } - return true; -} - void tap_dance_tap_hold_finished(tap_dance_state_t *state, void *user_data) { tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data; @@ -211,12 +197,29 @@ void tap_dance_tap_hold_reset(tap_dance_state_t *state, void *user_data) { } } -#define ACTION_TAP_DANCE_TAP_HOLD(tap, hold) \ - { .fn = {NULL, tap_dance_tap_hold_finished, tap_dance_tap_hold_reset}, .user_data = (void *)&((tap_dance_tap_hold_t){tap, hold, 0}), } +#define ACTION_TAP_DANCE_TAP_HOLD(tap, hold) \ + { \ + .fn = {NULL, tap_dance_tap_hold_finished, tap_dance_tap_hold_reset}, \ + .user_data = (void *)&((tap_dance_tap_hold_t){tap, hold, 0}), \ + } tap_dance_action_t tap_dance_actions[] = { [CT_CLN] = ACTION_TAP_DANCE_TAP_HOLD(KC_COLN, KC_SCLN), }; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + tap_dance_action_t *action; + + switch (keycode) { + case TD(CT_CLN): // list all tap dance keycodes with tap-hold configurations + action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(keycode)]; + if (!record->event.pressed && action->state.count && !action->state.finished) { + tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data; + tap_code16(tap_hold->tap); + } + } + return true; +} ``` #### Example 4: 'Quad Function Tap-Dance' {#example-4} |