aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/frosty_flake/keymaps/nikchi/keymap.c8
-rw-r--r--quantum/process_keycode/process_tap_dance.c6
-rw-r--r--quantum/process_keycode/process_tap_dance.h12
3 files changed, 18 insertions, 8 deletions
diff --git a/keyboards/frosty_flake/keymaps/nikchi/keymap.c b/keyboards/frosty_flake/keymaps/nikchi/keymap.c
index 3cfe0ede4..d522fdf1c 100644
--- a/keyboards/frosty_flake/keymaps/nikchi/keymap.c
+++ b/keyboards/frosty_flake/keymaps/nikchi/keymap.c
@@ -77,10 +77,10 @@ enum quick {
77qk_tap_dance_action_t tap_dance_actions[] = { 77qk_tap_dance_action_t tap_dance_actions[] = {
78 // Tap once for CTRL, twice for Caps Lock 78 // Tap once for CTRL, twice for Caps Lock
79 [TD_CTCPS] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_CAPS), 79 [TD_CTCPS] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_CAPS),
80 [EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleEmojis, NULL, NULL, 800), 80 [EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleEmojis, NULL, NULL, 800),
81 [ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED(cycleAnimals, NULL, NULL, 800), 81 [ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleAnimals, NULL, NULL, 800),
82 [HAND] = ACTION_TAP_DANCE_FN_ADVANCED(cycleHands, NULL, NULL, 800), 82 [HAND] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleHands, NULL, NULL, 800),
83 [MEMES] = ACTION_TAP_DANCE_FN_ADVANCED(cycleMemes, NULL, NULL, 800) 83 [MEMES] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleMemes, NULL, NULL, 800)
84// Other declarations would go here, separated by commas, if you have them 84// Other declarations would go here, separated by commas, if you have them
85}; 85};
86 86
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index e58b6f2df..2c7f6e937 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -127,6 +127,8 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
127 return true; 127 return true;
128} 128}
129 129
130
131
130void matrix_scan_tap_dance () { 132void matrix_scan_tap_dance () {
131 if (highest_td == -1) 133 if (highest_td == -1)
132 return; 134 return;
@@ -134,8 +136,8 @@ void matrix_scan_tap_dance () {
134 136
135for (int i = 0; i <= highest_td; i++) { 137for (int i = 0; i <= highest_td; i++) {
136 qk_tap_dance_action_t *action = &tap_dance_actions[i]; 138 qk_tap_dance_action_t *action = &tap_dance_actions[i];
137 if(action->user_data != NULL ) { 139 if(action->custom_tapping_term > 0 ) {
138 tap_user_defined = (int)action->user_data; 140 tap_user_defined = action->custom_tapping_term;
139 } 141 }
140 else{ 142 else{
141 tap_user_defined = TAPPING_TERM; 143 tap_user_defined = TAPPING_TERM;
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h
index 95d51f480..a020f7991 100644
--- a/quantum/process_keycode/process_tap_dance.h
+++ b/quantum/process_keycode/process_tap_dance.h
@@ -44,6 +44,7 @@ typedef struct
44 qk_tap_dance_user_fn_t on_reset; 44 qk_tap_dance_user_fn_t on_reset;
45 } fn; 45 } fn;
46 qk_tap_dance_state_t state; 46 qk_tap_dance_state_t state;
47 uint16_t custom_tapping_term;
47 void *user_data; 48 void *user_data;
48} qk_tap_dance_action_t; 49} qk_tap_dance_action_t;
49 50
@@ -63,9 +64,16 @@ typedef struct
63 .user_data = NULL, \ 64 .user_data = NULL, \
64 } 65 }
65 66
66#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \ 67#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \
67 .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \ 68 .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \
68 .user_data = (void *)(tap_specific_tapping_term), \ 69 .user_data = NULL, \
70 .custom_tapping_term = -1, \
71 }
72
73#define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \
74 .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \
75 .user_data = NULL, \
76 .custom_tapping_term = tap_specific_tapping_term, \
69 } 77 }
70 78
71extern qk_tap_dance_action_t tap_dance_actions[]; 79extern qk_tap_dance_action_t tap_dance_actions[];