diff options
author | Nick Choi <iinikchi@gmail.com> | 2017-05-25 00:41:00 -0400 |
---|---|---|
committer | Nick Choi <iinikchi@gmail.com> | 2017-05-25 00:41:00 -0400 |
commit | e695b5a33b97cfb4f9dd8bc8ecaff8aa7e0f14cc (patch) | |
tree | 3bbf264d0c3fdce8d4354a801637c6c923bb8299 | |
parent | 17a378715ebfe74f4e7b22520ab7626054f9f677 (diff) | |
download | qmk_firmware-e695b5a33b97cfb4f9dd8bc8ecaff8aa7e0f14cc.tar.gz qmk_firmware-e695b5a33b97cfb4f9dd8bc8ecaff8aa7e0f14cc.zip |
Added per case tapping term, updated FF-nikchi keymap.
-rw-r--r-- | keyboards/frosty_flake/keymaps/nikchi/config.h | 2 | ||||
-rw-r--r-- | keyboards/frosty_flake/keymaps/nikchi/keymap.c | 8 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 10 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.h | 4 |
4 files changed, 15 insertions, 9 deletions
diff --git a/keyboards/frosty_flake/keymaps/nikchi/config.h b/keyboards/frosty_flake/keymaps/nikchi/config.h index 31fcefefa..45825781d 100644 --- a/keyboards/frosty_flake/keymaps/nikchi/config.h +++ b/keyboards/frosty_flake/keymaps/nikchi/config.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include "../../config.h" | 4 | #include "../../config.h" |
5 | 5 | ||
6 | #define TAPPING_TERM 800 | 6 | #define TAPPING_TERM 200 |
7 | #define LEADER_TIMEOUT 400 | 7 | #define LEADER_TIMEOUT 400 |
8 | 8 | ||
9 | #define DISABLE_SPACE_CADET_ROLLOVER | 9 | #define DISABLE_SPACE_CADET_ROLLOVER |
diff --git a/keyboards/frosty_flake/keymaps/nikchi/keymap.c b/keyboards/frosty_flake/keymaps/nikchi/keymap.c index afb5197ca..3cfe0ede4 100644 --- a/keyboards/frosty_flake/keymaps/nikchi/keymap.c +++ b/keyboards/frosty_flake/keymaps/nikchi/keymap.c | |||
@@ -77,10 +77,10 @@ enum quick { | |||
77 | qk_tap_dance_action_t tap_dance_actions[] = { | 77 | qk_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), | 80 | [EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleEmojis, NULL, NULL, 800), |
81 | [ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED(cycleAnimals, NULL, NULL), | 81 | [ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED(cycleAnimals, NULL, NULL, 800), |
82 | [HAND] = ACTION_TAP_DANCE_FN_ADVANCED(cycleHands, NULL, NULL), | 82 | [HAND] = ACTION_TAP_DANCE_FN_ADVANCED(cycleHands, NULL, NULL, 800), |
83 | [MEMES] = ACTION_TAP_DANCE_FN_ADVANCED(cycleMemes, NULL, NULL) | 83 | [MEMES] = ACTION_TAP_DANCE_FN_ADVANCED(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 b807ec3c3..e58b6f2df 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
@@ -130,11 +130,17 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
130 | void matrix_scan_tap_dance () { | 130 | void matrix_scan_tap_dance () { |
131 | if (highest_td == -1) | 131 | if (highest_td == -1) |
132 | return; | 132 | return; |
133 | int tap_user_defined; | ||
133 | 134 | ||
134 | for (int i = 0; i <= highest_td; i++) { | 135 | for (int i = 0; i <= highest_td; i++) { |
135 | qk_tap_dance_action_t *action = &tap_dance_actions[i]; | 136 | qk_tap_dance_action_t *action = &tap_dance_actions[i]; |
136 | 137 | if(action->user_data != NULL ) { | |
137 | if (action->state.count && timer_elapsed (action->state.timer) > TAPPING_TERM) { | 138 | tap_user_defined = (int)action->user_data; |
139 | } | ||
140 | else{ | ||
141 | tap_user_defined = TAPPING_TERM; | ||
142 | } | ||
143 | if (action->state.count && timer_elapsed (action->state.timer) > tap_user_defined) { | ||
138 | process_tap_dance_action_on_dance_finished (action); | 144 | process_tap_dance_action_on_dance_finished (action); |
139 | reset_tap_dance (&action->state); | 145 | reset_tap_dance (&action->state); |
140 | } | 146 | } |
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index 330809f83..95d51f480 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h | |||
@@ -63,9 +63,9 @@ typedef struct | |||
63 | .user_data = NULL, \ | 63 | .user_data = NULL, \ |
64 | } | 64 | } |
65 | 65 | ||
66 | #define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \ | 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 | .fn = { 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 | .user_data = NULL, \ | 68 | .user_data = (void *)(tap_specific_tapping_term), \ |
69 | } | 69 | } |
70 | 70 | ||
71 | extern qk_tap_dance_action_t tap_dance_actions[]; | 71 | extern qk_tap_dance_action_t tap_dance_actions[]; |