From 4bac5f53d864a77a6f0fa8a2a046ed7748824ecc Mon Sep 17 00:00:00 2001 From: precondition <57645186+precondition@users.noreply.github.com> Date: Thu, 25 Nov 2021 20:06:50 +0000 Subject: New feature: `DYNAMIC_TAPPING_TERM_ENABLE` (#11036) * New feature: `DYNAMIC_TAPPING_TERM_ENABLE` 3 new quantum keys to configure the tapping term on the fly. * Replace sprintf call in tapping_term_report by get_u16_str * Replace tab with 4 spaces --- quantum/action_tapping.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'quantum/action_tapping.c') diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c index 0586fad421..b64d8b710b 100644 --- a/quantum/action_tapping.c +++ b/quantum/action_tapping.c @@ -24,12 +24,14 @@ # define IS_TAPPING_RECORD(r) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (r->event.key)) && tapping_key.keycode == r->keycode) # endif -__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; } +uint16_t g_tapping_term = TAPPING_TERM; + +__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return g_tapping_term; } # ifdef TAPPING_TERM_PER_KEY # define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_record_keycode(&tapping_key, false), &tapping_key)) # else -# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM) +# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < g_tapping_term) # endif # ifdef TAPPING_FORCE_HOLD_PER_KEY @@ -158,7 +160,7 @@ bool process_tapping(keyrecord_t *keyp) { # ifdef TAPPING_TERM_PER_KEY get_tapping_term(tapping_keycode, keyp) # else - TAPPING_TERM + g_tapping_term # endif >= 500 ) -- cgit v1.2.3