aboutsummaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode/process_space_cadet.c
diff options
context:
space:
mode:
authorGravatar Drashna Jaelre <drashna@live.com>2020-07-24 20:05:27 -0700
committerGravatar James Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commit9d3b26a47543d9898a2af2cee5f6ef53b4995e9f (patch)
tree934d032d2cdbb13c2223aa59ab854428407d5092 /quantum/process_keycode/process_space_cadet.c
parent3c74edbc691502228b2d2c4d42d5888311f0ca4c (diff)
downloadqmk_firmware-9d3b26a47543d9898a2af2cee5f6ef53b4995e9f.tar.gz
Update features to use Custom Tapping Term when appropriate (#6259)
* Update Space Cadet to use Custom Tapping Term functionality * Detect correct keycode for space cadet tapping term * Update tap dancing to use global custom tapping term * Update documentation for Tap Dances * formatting pass * Apply suggestions from code review Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update docs/feature_tap_dance.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * Update for future * Update user keymaps for space cadet * Fix typos * Clean up tapping term stuff * Fix compiler issue if NO_ACTION_TAPPING is enabled Co-authored-by: fauxpark <fauxpark@gmail.com> Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'quantum/process_keycode/process_space_cadet.c')
-rw-r--r--quantum/process_keycode/process_space_cadet.c23
1 files changed, 12 insertions, 11 deletions
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 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "process_space_cadet.h"
+#include "action_tapping.h"
-#ifndef TAPPING_TERM
-# define TAPPING_TERM 200
+#ifdef NO_ACTION_TAPPING
+__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; };
#endif
// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
@@ -85,7 +86,7 @@ static uint16_t sc_timer = 0;
static uint8_t sc_mods = 0;
#endif
-void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) {
+void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) {
if (record->event.pressed) {
sc_last = holdMod;
sc_timer = timer_read();
@@ -96,7 +97,7 @@ void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, u
register_mods(MOD_BIT(holdMod));
}
} else {
- if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) {
+ if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) {
if (holdMod != tapMod) {
if (IS_MOD(holdMod)) {
unregister_mods(MOD_BIT(holdMod));
@@ -126,31 +127,31 @@ void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, u
bool process_space_cadet(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_LSPO: {
- perform_space_cadet(record, LSPO_KEYS);
+ perform_space_cadet(record, keycode, LSPO_KEYS);
return false;
}
case KC_RSPC: {
- perform_space_cadet(record, RSPC_KEYS);
+ perform_space_cadet(record, keycode, RSPC_KEYS);
return false;
}
case KC_LCPO: {
- perform_space_cadet(record, LCPO_KEYS);
+ perform_space_cadet(record, keycode, LCPO_KEYS);
return false;
}
case KC_RCPC: {
- perform_space_cadet(record, RCPC_KEYS);
+ perform_space_cadet(record, keycode, RCPC_KEYS);
return false;
}
case KC_LAPO: {
- perform_space_cadet(record, LAPO_KEYS);
+ perform_space_cadet(record, keycode, LAPO_KEYS);
return false;
}
case KC_RAPC: {
- perform_space_cadet(record, RAPC_KEYS);
+ perform_space_cadet(record, keycode, RAPC_KEYS);
return false;
}
case KC_SFTENT: {
- perform_space_cadet(record, SFTENT_KEYS);
+ perform_space_cadet(record, keycode, SFTENT_KEYS);
return false;
}
default: {