summaryrefslogtreecommitdiff
path: root/users/edvorakjp/edvorakjp_tap_dance.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/edvorakjp/edvorakjp_tap_dance.c')
-rw-r--r--users/edvorakjp/edvorakjp_tap_dance.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/users/edvorakjp/edvorakjp_tap_dance.c b/users/edvorakjp/edvorakjp_tap_dance.c
index 62c0c100a2..d5369f9266 100644
--- a/users/edvorakjp/edvorakjp_tap_dance.c
+++ b/users/edvorakjp/edvorakjp_tap_dance.c
@@ -8,8 +8,11 @@ enum tap_state {
HOLD
};
-static int td_status_lower = NONE;
-static int td_status_raise = NONE;
+typedef struct {
+ uint8_t lower;
+ uint8_t raise;
+} td_status_t;
+static td_status_t td_status = {NONE, NONE};
int cur_dance(qk_tap_dance_state_t *state) {
if (state->interrupted || !state->pressed) {
@@ -20,14 +23,14 @@ int cur_dance(qk_tap_dance_state_t *state) {
}
void td_lower_finished(qk_tap_dance_state_t *state, void *user_data) {
- td_status_lower = cur_dance(state);
- switch(td_status_lower) {
+ td_status.lower = cur_dance(state);
+ switch(td_status.lower) {
case SINGLE_TAP:
set_japanese_mode(false);
- register_code(KC_ESC);
break;
case DOUBLE_TAP:
set_japanese_mode(false);
+ register_code(KC_ESC);
break;
case HOLD:
break;
@@ -36,18 +39,19 @@ void td_lower_finished(qk_tap_dance_state_t *state, void *user_data) {
}
void td_lower_reset(qk_tap_dance_state_t *state, void *user_data) {
- if (td_status_lower == SINGLE_TAP) {
+ if (td_status.lower == DOUBLE_TAP) {
unregister_code(KC_ESC);
}
layer_off(_LOWER);
- td_status_lower = NONE;
+ td_status.lower = NONE;
}
void td_raise_finished(qk_tap_dance_state_t *state, void *user_data) {
- td_status_raise = cur_dance(state);
- switch(td_status_raise) {
- case SINGLE_TAP:
+ td_status.raise = cur_dance(state);
+ switch(td_status.raise) {
case DOUBLE_TAP:
+ // same as single
+ case SINGLE_TAP:
set_japanese_mode(true);
break;
case HOLD:
@@ -58,14 +62,12 @@ void td_raise_finished(qk_tap_dance_state_t *state, void *user_data) {
void td_raise_reset(qk_tap_dance_state_t *state, void *user_data) {
layer_off(_RAISE);
- td_status_raise = NONE;
+ td_status.raise = NONE;
}
qk_tap_dance_action_t tap_dance_actions[] = {
- [TD_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(
- NULL, td_lower_finished, td_lower_reset, TAPPING_TERM * 1.5
- ),
- [TD_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(
- NULL, td_raise_finished, td_raise_reset, TAPPING_TERM * 1.5
- )
+ [TD_LOWER] =
+ ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_lower_finished, td_lower_reset, 100),
+ [TD_RAISE] =
+ ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_raise_finished, td_raise_reset, 100)
};