diff options
author | Jouke Witteveen <[email protected]> | 2022-04-16 20:24:09 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2022-04-16 11:24:09 -0700 |
commit | 8f585153c470b07bb0c529ff49b39ef45f68d37e (patch) | |
tree | 5441986fa041cd2d966b800af3f82d69b55e4d58 /quantum/action_tapping.h | |
parent | cad0af09a8a280d918b726eb472c86065dc5c079 (diff) | |
download | qmk_firmware-8f585153c470b07bb0c529ff49b39ef45f68d37e.tar.gz qmk_firmware-8f585153c470b07bb0c529ff49b39ef45f68d37e.zip |
Add GET_TAPPING_TERM macro to reduce duplicate code (#16681)
* Add GET_TAPPING_TERM macro to reduce duplicate code
The macro gives the right tapping term depending on whether per-key
tapping terms and/or dynamic tapping terms are enabled. Unnecessary
function calls and variable resolution are avoided.
Fixes #16472.
* Use GET_TAPPING_TERM for Cirque trackpads
Co-authored-by: Stefan Kerkmann <[email protected]>
Diffstat (limited to 'quantum/action_tapping.h')
-rw-r--r-- | quantum/action_tapping.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/quantum/action_tapping.h b/quantum/action_tapping.h index b2feb6850c..9b64c93120 100644 --- a/quantum/action_tapping.h +++ b/quantum/action_tapping.h @@ -44,3 +44,11 @@ bool get_retro_tapping(uint16_t keycode, keyrecord_t *record); #ifdef DYNAMIC_TAPPING_TERM_ENABLE extern uint16_t g_tapping_term; #endif + +#ifdef TAPPING_TERM_PER_KEY +# define GET_TAPPING_TERM(keycode, record) get_tapping_term(keycode, record) +#elif defined(DYNAMIC_TAPPING_TERM_ENABLE) +# define GET_TAPPING_TERM(keycode, record) g_tapping_term +#else +# define GET_TAPPING_TERM(keycode, record) (TAPPING_TERM) +#endif |