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
This commit is contained in:
precondition 2021-11-25 20:06:50 +00:00 committed by GitHub
parent 5e9c29da0d
commit 4bac5f53d8
Failed to generate hash of commit
13 changed files with 191 additions and 4 deletions

View file

@ -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
)