summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-09-12 16:48:11 -0700
committerGitHub <noreply@github.com>2021-09-13 00:48:11 +0100
commitab34ecb66993f0cb7fc2a6aa960d0d0c4bafb773 (patch)
treefa071fa3cf2c1f982cb23a14295d129afeeffcce /quantum
parent10362777a56194bf830f144d893fbd2ade2c174e (diff)
Apply `TAP_CODE_DELAY` to Tap Dance key sequences (#14412)
* Add support to tap dances * Move default tap code defines to header file
Diffstat (limited to 'quantum')
-rw-r--r--quantum/action.c6
-rw-r--r--quantum/action.h7
-rw-r--r--quantum/process_keycode/process_tap_dance.c2
3 files changed, 9 insertions, 6 deletions
diff --git a/quantum/action.c b/quantum/action.c
index d19fd2a045..be135f18f2 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
__attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { return true; }
-#ifndef TAP_CODE_DELAY
-# define TAP_CODE_DELAY 0
-#endif
-#ifndef TAP_HOLD_CAPS_DELAY
-# define TAP_HOLD_CAPS_DELAY 80
-#endif
/** \brief Called to execute an action.
*
* FIXME: Needs documentation.
diff --git a/quantum/action.h b/quantum/action.h
index 3d357b33b8..8a357ded87 100644
--- a/quantum/action.h
+++ b/quantum/action.h
@@ -38,6 +38,13 @@ extern "C" {
# endif
#endif
+#ifndef TAP_CODE_DELAY
+# define TAP_CODE_DELAY 0
+#endif
+#ifndef TAP_HOLD_CAPS_DELAY
+# define TAP_HOLD_CAPS_DELAY 80
+#endif
+
/* tapping count and state */
typedef struct {
bool interrupted : 1;
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index c8712d919f..225b36cd5f 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) {
void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
+ wait_ms(TAP_CODE_DELAY);
if (state->count == 1) {
unregister_code16(pair->kc1);
} 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)
qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
if (state->count == 1) {
+ wait_ms(TAP_CODE_DELAY);
unregister_code16(pair->kc);
}
}