diff options
| author | Nimish Gåtam <nimishg@gmail.com> | 2025-11-02 00:17:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-01 23:17:50 +0000 |
| commit | 8c93a33cd3c77ad3296c84a642d5f889fd13fac7 (patch) | |
| tree | 135080c17b8e864a4f0cf422caececa1d844daf8 /quantum | |
| parent | 6aade0ecdc7283b470a6dd1cccaa61268e3d5c53 (diff) | |
making flowtap timer public so it can be used easily with combos (#25731)
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/action_tapping.c | 7 | ||||
| -rw-r--r-- | quantum/action_tapping.h | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c index b105cd60a9..c2f45ea178 100644 --- a/quantum/action_tapping.c +++ b/quantum/action_tapping.c | |||
| @@ -883,6 +883,13 @@ static bool flow_tap_key_if_within_term(keyrecord_t *record, uint16_t prev_time) | |||
| 883 | return false; | 883 | return false; |
| 884 | } | 884 | } |
| 885 | 885 | ||
| 886 | // Checks both flow_tap_expired flag and elapsed time to determine | ||
| 887 | // if the key is within the flow tap term. | ||
| 888 | bool within_flow_tap_term(uint16_t keycode, keyrecord_t *record) { | ||
| 889 | uint16_t term = get_flow_tap_term(keycode, record, flow_tap_prev_keycode); | ||
| 890 | return !flow_tap_expired && TIMER_DIFF_16(record->event.time, flow_tap_prev_time) <= term; | ||
| 891 | } | ||
| 892 | |||
| 886 | // By default, enable Flow Tap for the keys in the main alphas area and Space. | 893 | // By default, enable Flow Tap for the keys in the main alphas area and Space. |
| 887 | // This should work reasonably even if the layout is remapped on the host to an | 894 | // This should work reasonably even if the layout is remapped on the host to an |
| 888 | // alt layout or international layout (e.g. Dvorak or AZERTY), where these same | 895 | // alt layout or international layout (e.g. Dvorak or AZERTY), where these same |
diff --git a/quantum/action_tapping.h b/quantum/action_tapping.h index 0cf4aa1200..8220952706 100644 --- a/quantum/action_tapping.h +++ b/quantum/action_tapping.h | |||
| @@ -169,6 +169,16 @@ uint16_t get_flow_tap_term(uint16_t keycode, keyrecord_t *record, uint16_t prev_ | |||
| 169 | 169 | ||
| 170 | /** Updates the Flow Tap last key and timer. */ | 170 | /** Updates the Flow Tap last key and timer. */ |
| 171 | void flow_tap_update_last_event(keyrecord_t *record); | 171 | void flow_tap_update_last_event(keyrecord_t *record); |
| 172 | |||
| 173 | /** | ||
| 174 | * Checks if the pressed key is within the flow tap term. | ||
| 175 | * Can be used to avoid triggering combos or other actions within the flow tap term. | ||
| 176 | * | ||
| 177 | * @param keycode The keycode of the pressed key. | ||
| 178 | * @param record The keyrecord of the pressed key. | ||
| 179 | * @return True if the pressed key is within the flow tap term; false otherwise. | ||
| 180 | */ | ||
| 181 | bool within_flow_tap_term(uint16_t keycode, keyrecord_t *record); | ||
| 172 | #endif // FLOW_TAP_TERM | 182 | #endif // FLOW_TAP_TERM |
| 173 | 183 | ||
| 174 | #ifdef DYNAMIC_TAPPING_TERM_ENABLE | 184 | #ifdef DYNAMIC_TAPPING_TERM_ENABLE |
