diff options
| author | Pavlos Vinieratos <pvinis@gmail.com> | 2016-07-15 23:54:08 +0200 |
|---|---|---|
| committer | Pavlos Vinieratos <pvinis@gmail.com> | 2016-07-17 08:28:03 +0200 |
| commit | d3091faf363afc8fef73ddf4948f872439b0e827 (patch) | |
| tree | 8741f3b0cf7ab54e3943598eafcef052faab30be /quantum/process_keycode/process_tap_dance.c | |
| parent | f3b56701ed7e6c622dc48e429780124ba5fde172 (diff) | |
| download | qmk_firmware-d3091faf363afc8fef73ddf4948f872439b0e827.tar.gz qmk_firmware-d3091faf363afc8fef73ddf4948f872439b0e827.zip | |
change naming, and remove extraneous definition
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.c')
| -rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 40fba2a6a..93b326b5f 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
| @@ -27,7 +27,7 @@ static void _process_tap_dance_action_fn (qk_tap_dance_state_t *state, | |||
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | void process_tap_dance_action (uint16_t keycode) | 30 | void process_tap_dance_action_on_each_tap (uint16_t keycode) |
| 31 | { | 31 | { |
| 32 | uint16_t idx = keycode - QK_TAP_DANCE; | 32 | uint16_t idx = keycode - QK_TAP_DANCE; |
| 33 | qk_tap_dance_action_t action; | 33 | qk_tap_dance_action_t action; |
| @@ -35,12 +35,8 @@ void process_tap_dance_action (uint16_t keycode) | |||
| 35 | action = tap_dance_actions[idx]; | 35 | action = tap_dance_actions[idx]; |
| 36 | 36 | ||
| 37 | switch (action.type) { | 37 | switch (action.type) { |
| 38 | case QK_TAP_DANCE_TYPE_PAIR: | ||
| 39 | _process_tap_dance_action_pair (&qk_tap_dance_state, | ||
| 40 | action.pair.kc1, action.pair.kc2); | ||
| 41 | break; | ||
| 42 | case QK_TAP_DANCE_TYPE_FN: | 38 | case QK_TAP_DANCE_TYPE_FN: |
| 43 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.fn.regular); | 39 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.fn.on_each_tap); |
| 44 | break; | 40 | break; |
| 45 | 41 | ||
| 46 | default: | 42 | default: |
| @@ -48,7 +44,7 @@ void process_tap_dance_action (uint16_t keycode) | |||
| 48 | } | 44 | } |
| 49 | } | 45 | } |
| 50 | 46 | ||
| 51 | void process_tap_dance_action_anyway (uint16_t keycode) | 47 | void process_tap_dance_action_on_dance_finished (uint16_t keycode) |
| 52 | { | 48 | { |
| 53 | uint16_t idx = keycode - QK_TAP_DANCE; | 49 | uint16_t idx = keycode - QK_TAP_DANCE; |
| 54 | qk_tap_dance_action_t action; | 50 | qk_tap_dance_action_t action; |
| @@ -56,8 +52,12 @@ void process_tap_dance_action_anyway (uint16_t keycode) | |||
| 56 | action = tap_dance_actions[idx]; | 52 | action = tap_dance_actions[idx]; |
| 57 | 53 | ||
| 58 | switch (action.type) { | 54 | switch (action.type) { |
| 55 | case QK_TAP_DANCE_TYPE_PAIR: | ||
| 56 | _process_tap_dance_action_pair (&qk_tap_dance_state, | ||
| 57 | action.pair.kc1, action.pair.kc2); | ||
| 58 | break; | ||
| 59 | case QK_TAP_DANCE_TYPE_FN: | 59 | case QK_TAP_DANCE_TYPE_FN: |
| 60 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.fn.anyway); | 60 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.fn.on_dance_finished); |
| 61 | break; | 61 | break; |
| 62 | 62 | ||
| 63 | default: | 63 | default: |
| @@ -70,9 +70,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 70 | 70 | ||
| 71 | switch(keycode) { | 71 | switch(keycode) { |
| 72 | case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: | 72 | case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: |
| 73 | process_tap_dance_action_anyway (qk_tap_dance_state.keycode); | 73 | process_tap_dance_action_on_each_tap (qk_tap_dance_state.keycode); |
| 74 | if (qk_tap_dance_state.keycode && qk_tap_dance_state.keycode != keycode) { | 74 | if (qk_tap_dance_state.keycode && qk_tap_dance_state.keycode != keycode) { |
| 75 | process_tap_dance_action (qk_tap_dance_state.keycode); | 75 | process_tap_dance_action_on_dance_finished (qk_tap_dance_state.keycode); |
| 76 | } else { | 76 | } else { |
| 77 | r = false; | 77 | r = false; |
| 78 | } | 78 | } |
| @@ -85,10 +85,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 85 | break; | 85 | break; |
| 86 | 86 | ||
| 87 | default: | 87 | default: |
| 88 | process_tap_dance_action_on_each_tap (qk_tap_dance_state.keycode); | ||
| 88 | if (qk_tap_dance_state.keycode) { | 89 | if (qk_tap_dance_state.keycode) { |
| 89 | //process_tap_dance_action_anyway (qk_tap_dance_state.keycode); | 90 | process_tap_dance_action_on_dance_finished (qk_tap_dance_state.keycode); |
| 90 | process_tap_dance_action (qk_tap_dance_state.keycode); | ||
| 91 | |||
| 92 | reset_tap_dance (&qk_tap_dance_state); | 91 | reset_tap_dance (&qk_tap_dance_state); |
| 93 | } | 92 | } |
| 94 | break; | 93 | break; |
| @@ -99,8 +98,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { | |||
| 99 | 98 | ||
| 100 | void matrix_scan_tap_dance () { | 99 | void matrix_scan_tap_dance () { |
| 101 | if (qk_tap_dance_state.keycode && timer_elapsed (qk_tap_dance_state.timer) > TAPPING_TERM) { | 100 | if (qk_tap_dance_state.keycode && timer_elapsed (qk_tap_dance_state.timer) > TAPPING_TERM) { |
| 102 | process_tap_dance_action (qk_tap_dance_state.keycode); | 101 | process_tap_dance_action_on_dance_finished (qk_tap_dance_state.keycode); |
| 103 | |||
| 104 | reset_tap_dance (&qk_tap_dance_state); | 102 | reset_tap_dance (&qk_tap_dance_state); |
| 105 | } | 103 | } |
| 106 | } | 104 | } |
| @@ -112,8 +110,8 @@ void reset_tap_dance (qk_tap_dance_state_t *state) { | |||
| 112 | action = tap_dance_actions[idx]; | 110 | action = tap_dance_actions[idx]; |
| 113 | switch (action.type) { | 111 | switch (action.type) { |
| 114 | case QK_TAP_DANCE_TYPE_FN: | 112 | case QK_TAP_DANCE_TYPE_FN: |
| 115 | if (action.fn.reset) { | 113 | if (action.fn.on_reset) { |
| 116 | action.fn.reset(); | 114 | action.fn.on_reset(state); |
| 117 | } | 115 | } |
| 118 | break; | 116 | break; |
| 119 | 117 | ||
