summaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-05-30 15:38:22 -0400
committerGitHub <noreply@github.com>2017-05-30 15:38:22 -0400
commit328bde1624ecf7c5bce878398f39dd580ded5014 (patch)
tree904169689b45d99760e7b64ba03a877a07036a14 /quantum/process_keycode
parentcb791cf6cdbcd9fd1291f36f6b1a6840753db97f (diff)
parent3c4022c41bc69b0bec94b2f34b6958ff41924254 (diff)
Merge pull request #1323 from nikchi/master
Variable tapping terms
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_tap_dance.c14
-rw-r--r--quantum/process_keycode/process_tap_dance.h7
2 files changed, 18 insertions, 3 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index b807ec3c30..4fd45810bb 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -127,14 +127,22 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
return true;
}
+
+
void matrix_scan_tap_dance () {
if (highest_td == -1)
return;
+ uint16_t tap_user_defined;
-for (int i = 0; i <= highest_td; i++) {
+for (uint8_t i = 0; i <= highest_td; i++) {
qk_tap_dance_action_t *action = &tap_dance_actions[i];
-
- if (action->state.count && timer_elapsed (action->state.timer) > TAPPING_TERM) {
+ if(action->custom_tapping_term > 0 ) {
+ tap_user_defined = action->custom_tapping_term;
+ }
+ else{
+ tap_user_defined = TAPPING_TERM;
+ }
+ if (action->state.count && timer_elapsed (action->state.timer) > tap_user_defined) {
process_tap_dance_action_on_dance_finished (action);
reset_tap_dance (&action->state);
}
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h
index 330809f83a..f42c154a05 100644
--- a/quantum/process_keycode/process_tap_dance.h
+++ b/quantum/process_keycode/process_tap_dance.h
@@ -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;
@@ -68,6 +69,12 @@ typedef struct
.user_data = NULL, \
}
+#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[];
/* To be used internally */