aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/feature_tap_dance.md4
-rw-r--r--keyboards/converter/usb_usb/keymaps/narze/keymap.c6
-rw-r--r--keyboards/ergodox_infinity/keymaps/narze/keymap.c6
-rw-r--r--keyboards/planck/keymaps/narze/keymap.c4
-rw-r--r--quantum/process_keycode/process_space_cadet.c23
-rw-r--r--quantum/process_keycode/process_space_cadet.h5
-rw-r--r--quantum/process_keycode/process_tap_dance.c6
7 files changed, 28 insertions, 26 deletions
diff --git a/docs/feature_tap_dance.md b/docs/feature_tap_dance.md
index 877c37336..d2da39ad2 100644
--- a/docs/feature_tap_dance.md
+++ b/docs/feature_tap_dance.md
@@ -28,7 +28,9 @@ After this, you'll want to use the `tap_dance_actions` array to specify what act
28* `ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer)`: Sends the `kc` keycode when tapped once, or toggles the state of `layer`. (this functions like the `TG` layer keycode). 28* `ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer)`: Sends the `kc` keycode when tapped once, or toggles the state of `layer`. (this functions like the `TG` layer keycode).
29* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action. 29* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action.
30* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function when the dance action finishes (like the previous option), and the last function when the tap dance action resets. 30* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function when the dance action finishes (like the previous option), and the last function when the tap dance action resets.
31* `ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`. 31* ~~`ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`~~: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`.
32 * This is deprecated in favor of the Per Key Tapping Term functionality, as outlined [here](custom_quantum_functions.md#Custom_Tapping_Term). You'd want to check for the specific `TD()` macro that you want to use (such as `TD(TD_ESC_CAPS)`) instead of using this specific Tap Dance function.
33
32 34
33The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise. 35The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise.
34 36
diff --git a/keyboards/converter/usb_usb/keymaps/narze/keymap.c b/keyboards/converter/usb_usb/keymaps/narze/keymap.c
index 510b93b7a..a84d613a2 100644
--- a/keyboards/converter/usb_usb/keymaps/narze/keymap.c
+++ b/keyboards/converter/usb_usb/keymaps/narze/keymap.c
@@ -130,17 +130,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
130 130
131 // 1. Hold for LGUI, tap for Underscore 131 // 1. Hold for LGUI, tap for Underscore
132 case GUI_UNDS: 132 case GUI_UNDS:
133 perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS); 133 perform_space_cadet(record, keycode, KC_LGUI, KC_LSFT, KC_MINS);
134 return false; 134 return false;
135 135
136 // 2. Hold for LSHIFT, tap for Parens open 136 // 2. Hold for LSHIFT, tap for Parens open
137 case LSFT_LPRN: 137 case LSFT_LPRN:
138 perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9); 138 perform_space_cadet(record, keycode, KC_LSFT, KC_LSFT, KC_9);
139 return false; 139 return false;
140 140
141 // 3. Hold for RSHIFT, tap for Parens close 141 // 3. Hold for RSHIFT, tap for Parens close
142 case RSFT_RPRN: 142 case RSFT_RPRN:
143 perform_space_cadet(record, KC_RSFT, KC_RSFT, KC_0); 143 perform_space_cadet(record, keycode, KC_RSFT, KC_RSFT, KC_0);
144 return false; 144 return false;
145 145
146 default: 146 default:
diff --git a/keyboards/ergodox_infinity/keymaps/narze/keymap.c b/keyboards/ergodox_infinity/keymaps/narze/keymap.c
index dcabd657b..d9499f003 100644
--- a/keyboards/ergodox_infinity/keymaps/narze/keymap.c
+++ b/keyboards/ergodox_infinity/keymaps/narze/keymap.c
@@ -635,17 +635,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
635 635
636 // 1. Hold for LGUI, tap for Underscore 636 // 1. Hold for LGUI, tap for Underscore
637 case GUI_UNDS: 637 case GUI_UNDS:
638 perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS); 638 perform_space_cadet(record, keycode, KC_LGUI, KC_LSFT, KC_MINS);
639 return false; 639 return false;
640 640
641 // 2. Hold for LSHIFT, tap for Parens open 641 // 2. Hold for LSHIFT, tap for Parens open
642 case LSFT_LPRN: 642 case LSFT_LPRN:
643 perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9); 643 perform_space_cadet(record, keycode, KC_LSFT, KC_LSFT, KC_9);
644 return false; 644 return false;
645 645
646 // 3. Hold for RSHIFT, tap for Parens close 646 // 3. Hold for RSHIFT, tap for Parens close
647 case RSFT_RPRN: 647 case RSFT_RPRN:
648 perform_space_cadet(record, KC_RSFT, KC_RSFT, KC_0); 648 perform_space_cadet(record, keycode, KC_RSFT, KC_RSFT, KC_0);
649 return false; 649 return false;
650 650
651 } 651 }
diff --git a/keyboards/planck/keymaps/narze/keymap.c b/keyboards/planck/keymaps/narze/keymap.c
index 7fead3205..81cb68ecc 100644
--- a/keyboards/planck/keymaps/narze/keymap.c
+++ b/keyboards/planck/keymaps/narze/keymap.c
@@ -330,12 +330,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
330 330
331 // 1. Hold for LGUI, tap for Underscore 331 // 1. Hold for LGUI, tap for Underscore
332 case GUI_UNDS: 332 case GUI_UNDS:
333 perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS); 333 perform_space_cadet(record, keycode, KC_LGUI, KC_LSFT, KC_MINS);
334 return false; 334 return false;
335 335
336 // 2. Hold for LSHIFT, tap for Parens open 336 // 2. Hold for LSHIFT, tap for Parens open
337 case LSFT_LPRN: 337 case LSFT_LPRN:
338 perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9); 338 perform_space_cadet(record, keycode, KC_LSFT, KC_LSFT, KC_9);
339 return false; 339 return false;
340 340
341 default: 341 default:
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c
index 6833fdb9f..bcaf62a96 100644
--- a/quantum/process_keycode/process_space_cadet.c
+++ b/quantum/process_keycode/process_space_cadet.c
@@ -14,9 +14,10 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "process_space_cadet.h" 16#include "process_space_cadet.h"
17#include "action_tapping.h"
17 18
18#ifndef TAPPING_TERM 19#ifdef NO_ACTION_TAPPING
19# define TAPPING_TERM 200 20__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; };
20#endif 21#endif
21 22
22// ********** OBSOLETE DEFINES, STOP USING! (pls?) ********** 23// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
@@ -85,7 +86,7 @@ static uint16_t sc_timer = 0;
85static uint8_t sc_mods = 0; 86static uint8_t sc_mods = 0;
86#endif 87#endif
87 88
88void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) { 89void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) {
89 if (record->event.pressed) { 90 if (record->event.pressed) {
90 sc_last = holdMod; 91 sc_last = holdMod;
91 sc_timer = timer_read(); 92 sc_timer = timer_read();
@@ -96,7 +97,7 @@ void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, u
96 register_mods(MOD_BIT(holdMod)); 97 register_mods(MOD_BIT(holdMod));
97 } 98 }
98 } else { 99 } else {
99 if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) { 100 if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) {
100 if (holdMod != tapMod) { 101 if (holdMod != tapMod) {
101 if (IS_MOD(holdMod)) { 102 if (IS_MOD(holdMod)) {
102 unregister_mods(MOD_BIT(holdMod)); 103 unregister_mods(MOD_BIT(holdMod));
@@ -126,31 +127,31 @@ void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, u
126bool process_space_cadet(uint16_t keycode, keyrecord_t *record) { 127bool process_space_cadet(uint16_t keycode, keyrecord_t *record) {
127 switch (keycode) { 128 switch (keycode) {
128 case KC_LSPO: { 129 case KC_LSPO: {
129 perform_space_cadet(record, LSPO_KEYS); 130 perform_space_cadet(record, keycode, LSPO_KEYS);
130 return false; 131 return false;
131 } 132 }
132 case KC_RSPC: { 133 case KC_RSPC: {
133 perform_space_cadet(record, RSPC_KEYS); 134 perform_space_cadet(record, keycode, RSPC_KEYS);
134 return false; 135 return false;
135 } 136 }
136 case KC_LCPO: { 137 case KC_LCPO: {
137 perform_space_cadet(record, LCPO_KEYS); 138 perform_space_cadet(record, keycode, LCPO_KEYS);
138 return false; 139 return false;
139 } 140 }
140 case KC_RCPC: { 141 case KC_RCPC: {
141 perform_space_cadet(record, RCPC_KEYS); 142 perform_space_cadet(record, keycode, RCPC_KEYS);
142 return false; 143 return false;
143 } 144 }
144 case KC_LAPO: { 145 case KC_LAPO: {
145 perform_space_cadet(record, LAPO_KEYS); 146 perform_space_cadet(record, keycode, LAPO_KEYS);
146 return false; 147 return false;
147 } 148 }
148 case KC_RAPC: { 149 case KC_RAPC: {
149 perform_space_cadet(record, RAPC_KEYS); 150 perform_space_cadet(record, keycode, RAPC_KEYS);
150 return false; 151 return false;
151 } 152 }
152 case KC_SFTENT: { 153 case KC_SFTENT: {
153 perform_space_cadet(record, SFTENT_KEYS); 154 perform_space_cadet(record, keycode, SFTENT_KEYS);
154 return false; 155 return false;
155 } 156 }
156 default: { 157 default: {
diff --git a/quantum/process_keycode/process_space_cadet.h b/quantum/process_keycode/process_space_cadet.h
index c82314350..3ace07399 100644
--- a/quantum/process_keycode/process_space_cadet.h
+++ b/quantum/process_keycode/process_space_cadet.h
@@ -17,5 +17,8 @@
17 17
18#include "quantum.h" 18#include "quantum.h"
19 19
20void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); 20void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode);
21bool process_space_cadet(uint16_t keycode, keyrecord_t *record); 21bool process_space_cadet(uint16_t keycode, keyrecord_t *record);
22#ifdef NO_ACTION_TAPPING
23uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
24#endif
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index 16756e59c..0c7b6353e 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -16,10 +16,6 @@
16#include "quantum.h" 16#include "quantum.h"
17#include "action_tapping.h" 17#include "action_tapping.h"
18 18
19#ifndef TAPPING_TERM
20# define TAPPING_TERM 200
21#endif
22
23#ifndef NO_ACTION_ONESHOT 19#ifndef NO_ACTION_ONESHOT
24uint8_t get_oneshot_mods(void); 20uint8_t get_oneshot_mods(void);
25#endif 21#endif
@@ -171,7 +167,7 @@ void matrix_scan_tap_dance() {
171 if (action->custom_tapping_term > 0) { 167 if (action->custom_tapping_term > 0) {
172 tap_user_defined = action->custom_tapping_term; 168 tap_user_defined = action->custom_tapping_term;
173 } else { 169 } else {
174 tap_user_defined = TAPPING_TERM; 170 tap_user_defined = get_tapping_term(action->state.keycode, NULL);
175 } 171 }
176 if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) { 172 if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) {
177 process_tap_dance_action_on_dance_finished(action); 173 process_tap_dance_action_on_dance_finished(action);