|
|
@ -39,7 +39,8 @@ enum flavor { |
|
|
|
enum status { |
|
|
|
enum status { |
|
|
|
STATUS_UNDECIDED, |
|
|
|
STATUS_UNDECIDED, |
|
|
|
STATUS_TAP, |
|
|
|
STATUS_TAP, |
|
|
|
STATUS_HOLD, |
|
|
|
STATUS_HOLD_INTERRUPT, |
|
|
|
|
|
|
|
STATUS_HOLD_TIMER, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct behavior_hold_tap_config { |
|
|
|
struct behavior_hold_tap_config { |
|
|
@ -221,8 +222,10 @@ static void decide_balanced(struct active_hold_tap *hold_tap, enum decision_mome |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
return; |
|
|
|
return; |
|
|
|
case HT_OTHER_KEY_UP: |
|
|
|
case HT_OTHER_KEY_UP: |
|
|
|
|
|
|
|
hold_tap->status = STATUS_HOLD_INTERRUPT; |
|
|
|
|
|
|
|
return; |
|
|
|
case HT_TIMER_EVENT: |
|
|
|
case HT_TIMER_EVENT: |
|
|
|
hold_tap->status = STATUS_HOLD; |
|
|
|
hold_tap->status = STATUS_HOLD_TIMER; |
|
|
|
return; |
|
|
|
return; |
|
|
|
case HT_QUICK_TAP: |
|
|
|
case HT_QUICK_TAP: |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
@ -238,7 +241,7 @@ static void decide_tap_preferred(struct active_hold_tap *hold_tap, enum decision |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
return; |
|
|
|
return; |
|
|
|
case HT_TIMER_EVENT: |
|
|
|
case HT_TIMER_EVENT: |
|
|
|
hold_tap->status = STATUS_HOLD; |
|
|
|
hold_tap->status = STATUS_HOLD_TIMER; |
|
|
|
return; |
|
|
|
return; |
|
|
|
case HT_QUICK_TAP: |
|
|
|
case HT_QUICK_TAP: |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
@ -254,8 +257,10 @@ static void decide_hold_preferred(struct active_hold_tap *hold_tap, enum decisio |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
return; |
|
|
|
return; |
|
|
|
case HT_OTHER_KEY_DOWN: |
|
|
|
case HT_OTHER_KEY_DOWN: |
|
|
|
|
|
|
|
hold_tap->status = STATUS_HOLD_INTERRUPT; |
|
|
|
|
|
|
|
return; |
|
|
|
case HT_TIMER_EVENT: |
|
|
|
case HT_TIMER_EVENT: |
|
|
|
hold_tap->status = STATUS_HOLD; |
|
|
|
hold_tap->status = STATUS_HOLD_TIMER; |
|
|
|
return; |
|
|
|
return; |
|
|
|
case HT_QUICK_TAP: |
|
|
|
case HT_QUICK_TAP: |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
|
hold_tap->status = STATUS_TAP; |
|
|
@ -281,8 +286,10 @@ static inline const char *status_str(enum status status) { |
|
|
|
switch (status) { |
|
|
|
switch (status) { |
|
|
|
case STATUS_UNDECIDED: |
|
|
|
case STATUS_UNDECIDED: |
|
|
|
return "undecided"; |
|
|
|
return "undecided"; |
|
|
|
case STATUS_HOLD: |
|
|
|
case STATUS_HOLD_TIMER: |
|
|
|
return "hold"; |
|
|
|
return "hold-timer"; |
|
|
|
|
|
|
|
case STATUS_HOLD_INTERRUPT: |
|
|
|
|
|
|
|
return "hold-interrupt"; |
|
|
|
case STATUS_TAP: |
|
|
|
case STATUS_TAP: |
|
|
|
return "tap"; |
|
|
|
return "tap"; |
|
|
|
} |
|
|
|
} |
|
|
@ -322,7 +329,7 @@ static void decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_mome |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct zmk_behavior_binding binding; |
|
|
|
struct zmk_behavior_binding binding; |
|
|
|
if (hold_tap->status == STATUS_HOLD) { |
|
|
|
if (hold_tap->status & STATUS_HOLD) { |
|
|
|
binding.behavior_dev = hold_tap->config->hold_behavior_dev; |
|
|
|
binding.behavior_dev = hold_tap->config->hold_behavior_dev; |
|
|
|
binding.param1 = hold_tap->param_hold; |
|
|
|
binding.param1 = hold_tap->param_hold; |
|
|
|
binding.param2 = 0; |
|
|
|
binding.param2 = 0; |
|
|
@ -397,7 +404,7 @@ static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct zmk_behavior_binding sub_behavior_binding; |
|
|
|
struct zmk_behavior_binding sub_behavior_binding; |
|
|
|
if (hold_tap->status == STATUS_HOLD) { |
|
|
|
if (hold_tap->status & STATUS_HOLD) { |
|
|
|
sub_behavior_binding.behavior_dev = hold_tap->config->hold_behavior_dev; |
|
|
|
sub_behavior_binding.behavior_dev = hold_tap->config->hold_behavior_dev; |
|
|
|
sub_behavior_binding.param1 = hold_tap->param_hold; |
|
|
|
sub_behavior_binding.param1 = hold_tap->param_hold; |
|
|
|
sub_behavior_binding.param2 = 0; |
|
|
|
sub_behavior_binding.param2 = 0; |
|
|
|