moved specific tap term to its own function
included custom_tapping_term in action struct
This commit is contained in:
parent
e695b5a33b
commit
aeb3a34636
|
@ -77,10 +77,10 @@ enum quick {
|
|||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
// Tap once for CTRL, twice for Caps Lock
|
||||
[TD_CTCPS] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_CAPS),
|
||||
[EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleEmojis, NULL, NULL, 800),
|
||||
[ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED(cycleAnimals, NULL, NULL, 800),
|
||||
[HAND] = ACTION_TAP_DANCE_FN_ADVANCED(cycleHands, NULL, NULL, 800),
|
||||
[MEMES] = ACTION_TAP_DANCE_FN_ADVANCED(cycleMemes, NULL, NULL, 800)
|
||||
[EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleEmojis, NULL, NULL, 800),
|
||||
[ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleAnimals, NULL, NULL, 800),
|
||||
[HAND] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleHands, NULL, NULL, 800),
|
||||
[MEMES] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleMemes, NULL, NULL, 800)
|
||||
// Other declarations would go here, separated by commas, if you have them
|
||||
};
|
||||
|
||||
|
|
|
@ -127,6 +127,8 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void matrix_scan_tap_dance () {
|
||||
if (highest_td == -1)
|
||||
return;
|
||||
|
@ -134,8 +136,8 @@ void matrix_scan_tap_dance () {
|
|||
|
||||
for (int i = 0; i <= highest_td; i++) {
|
||||
qk_tap_dance_action_t *action = &tap_dance_actions[i];
|
||||
if(action->user_data != NULL ) {
|
||||
tap_user_defined = (int)action->user_data;
|
||||
if(action->custom_tapping_term > 0 ) {
|
||||
tap_user_defined = action->custom_tapping_term;
|
||||
}
|
||||
else{
|
||||
tap_user_defined = TAPPING_TERM;
|
||||
|
|
|
@ -44,6 +44,7 @@ typedef struct
|
|||
qk_tap_dance_user_fn_t on_reset;
|
||||
} fn;
|
||||
qk_tap_dance_state_t state;
|
||||
uint16_t custom_tapping_term;
|
||||
void *user_data;
|
||||
} qk_tap_dance_action_t;
|
||||
|
||||
|
@ -63,9 +64,16 @@ typedef struct
|
|||
.user_data = NULL, \
|
||||
}
|
||||
|
||||
#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) { \
|
||||
#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \
|
||||
.fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \
|
||||
.user_data = (void *)(tap_specific_tapping_term), \
|
||||
.user_data = NULL, \
|
||||
.custom_tapping_term = -1, \
|
||||
}
|
||||
|
||||
#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) { \
|
||||
.fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \
|
||||
.user_data = NULL, \
|
||||
.custom_tapping_term = tap_specific_tapping_term, \
|
||||
}
|
||||
|
||||
extern qk_tap_dance_action_t tap_dance_actions[];
|
||||
|
|
Loading…
Reference in New Issue