From 8f585153c470b07bb0c529ff49b39ef45f68d37e Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Sat, 16 Apr 2022 20:24:09 +0200 Subject: 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 --- docs/tap_hold.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/tap_hold.md') diff --git a/docs/tap_hold.md b/docs/tap_hold.md index 39fa84a9f3..601aef0493 100644 --- a/docs/tap_hold.md +++ b/docs/tap_hold.md @@ -112,7 +112,7 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { } ``` -The reason being that `TAPPING_TERM` is a macro that expands to a constant integer and thus cannot be changed at runtime whereas `g_tapping_term` is a variable whose value can be changed at runtime. If you want, you can temporarily enable `DYNAMIC_TAPPING_TERM_ENABLE` to find a suitable tapping term value and then disable that feature and revert back to using the classic syntax for per-key tapping term settings. +The reason being that `TAPPING_TERM` is a macro that expands to a constant integer and thus cannot be changed at runtime whereas `g_tapping_term` is a variable whose value can be changed at runtime. If you want, you can temporarily enable `DYNAMIC_TAPPING_TERM_ENABLE` to find a suitable tapping term value and then disable that feature and revert back to using the classic syntax for per-key tapping term settings. In case you need to access the tapping term from elsewhere in your code, you can use the `GET_TAPPING_TERM(keycode, record)` macro. This macro will expand to whatever is the appropriate access pattern given the current configuration. ## Tap-Or-Hold Decision Modes -- cgit v1.2.3