diff options
| author | ridingqwerty <george.g.koenig@gmail.com> | 2020-01-17 15:49:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-17 15:49:23 -0500 |
| commit | 95c24bbaf8ed2b3c9ee79226dea782dc84764c56 (patch) | |
| tree | b261a23add06ad615e4503cf423bf788b1b050ba /tmk_core | |
| parent | 1b0854fdca06d24324eecbb565702bbd337ef339 (diff) | |
| download | qmk_firmware-95c24bbaf8ed2b3c9ee79226dea782dc84764c56.tar.gz qmk_firmware-95c24bbaf8ed2b3c9ee79226dea782dc84764c56.zip | |
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')
| -rw-r--r-- | tmk_core/common/action_tapping.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index 8531dff36..c0f1f694b 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 | |||
| 27 | # define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM) | 27 | # define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM) |
| 28 | # endif | 28 | # endif |
| 29 | 29 | ||
| 30 | # ifdef TAPPING_FORCE_HOLD_PER_KEY | ||
| 31 | __attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { return false; } | ||
| 32 | # endif | ||
| 33 | |||
| 30 | static keyrecord_t tapping_key = {}; | 34 | static keyrecord_t tapping_key = {}; |
| 31 | static keyrecord_t waiting_buffer[WAITING_BUFFER_SIZE] = {}; | 35 | static keyrecord_t waiting_buffer[WAITING_BUFFER_SIZE] = {}; |
| 32 | static uint8_t waiting_buffer_head = 0; | 36 | static uint8_t waiting_buffer_head = 0; |
| @@ -232,8 +236,13 @@ bool process_tapping(keyrecord_t *keyp) { | |||
| 232 | if (WITHIN_TAPPING_TERM(event)) { | 236 | if (WITHIN_TAPPING_TERM(event)) { |
| 233 | if (event.pressed) { | 237 | if (event.pressed) { |
| 234 | if (IS_TAPPING_KEY(event.key)) { | 238 | if (IS_TAPPING_KEY(event.key)) { |
| 235 | # ifndef TAPPING_FORCE_HOLD | 239 | //# ifndef TAPPING_FORCE_HOLD |
| 236 | if (!tapping_key.tap.interrupted && tapping_key.tap.count > 0) { | 240 | # if !defined(TAPPING_FORCE_HOLD) || defined(TAPPING_FORCE_HOLD_PER_KEY) |
| 241 | if ( | ||
| 242 | # ifdef TAPPING_FORCE_HOLD_PER_KEY | ||
| 243 | !get_tapping_force_hold(get_event_keycode(tapping_key.event), keyp) && | ||
| 244 | # endif | ||
| 245 | !tapping_key.tap.interrupted && tapping_key.tap.count > 0) { | ||
| 237 | // sequential tap. | 246 | // sequential tap. |
| 238 | keyp->tap = tapping_key.tap; | 247 | keyp->tap = tapping_key.tap; |
| 239 | if (keyp->tap.count < 15) keyp->tap.count += 1; | 248 | if (keyp->tap.count < 15) keyp->tap.count += 1; |
