diff options
| author | Drashna Jaelre <drashna@live.com> | 2021-09-12 16:48:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-13 00:48:11 +0100 |
| commit | ab34ecb66993f0cb7fc2a6aa960d0d0c4bafb773 (patch) | |
| tree | fa071fa3cf2c1f982cb23a14295d129afeeffcce | |
| parent | 10362777a56194bf830f144d893fbd2ade2c174e (diff) | |
| download | qmk_firmware-ab34ecb66993f0cb7fc2a6aa960d0d0c4bafb773.tar.gz qmk_firmware-ab34ecb66993f0cb7fc2a6aa960d0d0c4bafb773.zip | |
Apply `TAP_CODE_DELAY` to Tap Dance key sequences (#14412)
* Add support to tap dances
* Move default tap code defines to header file
| -rw-r--r-- | quantum/action.c | 6 | ||||
| -rw-r--r-- | quantum/action.h | 7 | ||||
| -rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/quantum/action.c b/quantum/action.c index d19fd2a04..be135f18f 100644 --- a/quantum/action.c +++ b/quantum/action.c | |||
| @@ -57,12 +57,6 @@ __attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *reco | |||
| 57 | 57 | ||
| 58 | __attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { return true; } | 58 | __attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { return true; } |
| 59 | 59 | ||
| 60 | #ifndef TAP_CODE_DELAY | ||
| 61 | # define TAP_CODE_DELAY 0 | ||
| 62 | #endif | ||
| 63 | #ifndef TAP_HOLD_CAPS_DELAY | ||
| 64 | # define TAP_HOLD_CAPS_DELAY 80 | ||
| 65 | #endif | ||
| 66 | /** \brief Called to execute an action. | 60 | /** \brief Called to execute an action. |
| 67 | * | 61 | * |
| 68 | * FIXME: Needs documentation. | 62 | * FIXME: Needs documentation. |
diff --git a/quantum/action.h b/quantum/action.h index 3d357b33b..8a357ded8 100644 --- a/quantum/action.h +++ b/quantum/action.h | |||
| @@ -38,6 +38,13 @@ extern "C" { | |||
| 38 | # endif | 38 | # endif |
| 39 | #endif | 39 | #endif |
| 40 | 40 | ||
| 41 | #ifndef TAP_CODE_DELAY | ||
| 42 | # define TAP_CODE_DELAY 0 | ||
| 43 | #endif | ||
| 44 | #ifndef TAP_HOLD_CAPS_DELAY | ||
| 45 | # define TAP_HOLD_CAPS_DELAY 80 | ||
| 46 | #endif | ||
| 47 | |||
| 41 | /* tapping count and state */ | 48 | /* tapping count and state */ |
| 42 | typedef struct { | 49 | typedef struct { |
| 43 | bool interrupted : 1; | 50 | bool interrupted : 1; |
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index c8712d919..225b36cd5 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
| @@ -44,6 +44,7 @@ void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data) { | |||
| 44 | void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) { | 44 | void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) { |
| 45 | qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; | 45 | qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; |
| 46 | 46 | ||
| 47 | wait_ms(TAP_CODE_DELAY); | ||
| 47 | if (state->count == 1) { | 48 | if (state->count == 1) { |
| 48 | unregister_code16(pair->kc1); | 49 | unregister_code16(pair->kc1); |
| 49 | } else if (state->count == 2) { | 50 | } else if (state->count == 2) { |
| @@ -74,6 +75,7 @@ void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data) | |||
| 74 | qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data; | 75 | qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data; |
| 75 | 76 | ||
| 76 | if (state->count == 1) { | 77 | if (state->count == 1) { |
| 78 | wait_ms(TAP_CODE_DELAY); | ||
| 77 | unregister_code16(pair->kc); | 79 | unregister_code16(pair->kc); |
| 78 | } | 80 | } |
| 79 | } | 81 | } |
