summaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorridingqwerty <george.g.koenig@gmail.com>2020-01-17 15:49:23 -0500
committerFlorian Didron <fdidron@users.noreply.github.com>2020-02-26 10:15:12 +0900
commit9986ef7635ba4360d868b18a5dcf452ca50af833 (patch)
tree39d33e83a57fab379b61aa1c4f94012afaac11d7 /tmk_core/common
parente5890845a727313005fde7fe3e324e2b658c6d21 (diff)
Implement and document TAPPING_FORCE_HOLD_PER_KEY (#7859)
* Implement and document TAPPING_FORCE_HOLD_PER_KEY * Added "record" parameter to "get_tapping_force_hold" * Correct typo -- remove 'IGNORE_' from 'IGNORE_TAPPING_FORCE_HOLD_PER_KEY' Co-authored-by: GeorgeKoenig <35542036+GeorgeKoenig@users.noreply.github.com>
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/action_tapping.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c
index 8531dff360..c0f1f694b7 100644
--- a/tmk_core/common/action_tapping.c
+++ b/tmk_core/common/action_tapping.c
@@ -27,6 +27,10 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode) { return TAPPI
# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM)
# endif
+# ifdef TAPPING_FORCE_HOLD_PER_KEY
+__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { return false; }
+# endif
+
static keyrecord_t tapping_key = {};
static keyrecord_t waiting_buffer[WAITING_BUFFER_SIZE] = {};
static uint8_t waiting_buffer_head = 0;
@@ -232,8 +236,13 @@ bool process_tapping(keyrecord_t *keyp) {
if (WITHIN_TAPPING_TERM(event)) {
if (event.pressed) {
if (IS_TAPPING_KEY(event.key)) {
-# ifndef TAPPING_FORCE_HOLD
- if (!tapping_key.tap.interrupted && tapping_key.tap.count > 0) {
+//# ifndef TAPPING_FORCE_HOLD
+# if !defined(TAPPING_FORCE_HOLD) || defined(TAPPING_FORCE_HOLD_PER_KEY)
+ if (
+# ifdef TAPPING_FORCE_HOLD_PER_KEY
+ !get_tapping_force_hold(get_event_keycode(tapping_key.event), keyp) &&
+# endif
+ !tapping_key.tap.interrupted && tapping_key.tap.count > 0) {
// sequential tap.
keyp->tap = tapping_key.tap;
if (keyp->tap.count < 15) keyp->tap.count += 1;