rename to hold_trigger_key_positions

This commit is contained in:
jmding8 2021-10-29 02:21:11 +00:00
parent 48888318d1
commit 7f636baf73
2 changed files with 8 additions and 8 deletions

View file

@ -30,7 +30,7 @@ properties:
- "tap-preferred" - "tap-preferred"
retro-tap: retro-tap:
type: boolean type: boolean
hold-enabler-keys: hold-trigger-key-positions:
type: array type: array
required: false required: false
default: [] default: []

View file

@ -58,8 +58,8 @@ struct behavior_hold_tap_config {
int quick_tap_ms; int quick_tap_ms;
enum flavor flavor; enum flavor flavor;
bool retro_tap; bool retro_tap;
int32_t hold_enabler_keys[ZMK_KEYMAP_LEN]; int32_t hold_trigger_key_positions[ZMK_KEYMAP_LEN];
int32_t hold_enabler_keys_len; int32_t hold_trigger_key_positions_len;
}; };
// this data is specific for each hold-tap // this data is specific for each hold-tap
@ -366,12 +366,12 @@ static int release_binding(struct active_hold_tap *hold_tap) {
} }
static bool is_positional_hold_tap_enabled(struct active_hold_tap *hold_tap) { static bool is_positional_hold_tap_enabled(struct active_hold_tap *hold_tap) {
return (hold_tap->config->hold_enabler_keys_len > 0); return (hold_tap->config->hold_trigger_key_positions_len > 0);
} }
static bool passes_positional_hold_conditions(struct active_hold_tap *hold_tap) { static bool passes_positional_hold_conditions(struct active_hold_tap *hold_tap) {
for (int i = 0; i < hold_tap->config->hold_enabler_keys_len; i++) { for (int i = 0; i < hold_tap->config->hold_trigger_key_positions_len; i++) {
if (hold_tap->config->hold_enabler_keys[i] == if (hold_tap->config->hold_trigger_key_positions[i] ==
hold_tap->position_of_first_other_key_pressed) { hold_tap->position_of_first_other_key_pressed) {
return true; return true;
} }
@ -643,8 +643,8 @@ static struct behavior_hold_tap_data behavior_hold_tap_data;
.quick_tap_ms = DT_INST_PROP(n, quick_tap_ms), \ .quick_tap_ms = DT_INST_PROP(n, quick_tap_ms), \
.flavor = DT_ENUM_IDX(DT_DRV_INST(n), flavor), \ .flavor = DT_ENUM_IDX(DT_DRV_INST(n), flavor), \
.retro_tap = DT_INST_PROP(n, retro_tap), \ .retro_tap = DT_INST_PROP(n, retro_tap), \
.hold_enabler_keys = DT_INST_PROP(n, hold_enabler_keys), \ .hold_trigger_key_positions = DT_INST_PROP(n, hold_trigger_key_positions), \
.hold_enabler_keys_len = DT_INST_PROP_LEN(n, hold_enabler_keys), \ .hold_trigger_key_positions_len = DT_INST_PROP_LEN(n, hold_trigger_key_positions), \
}; \ }; \
DEVICE_DT_INST_DEFINE(n, behavior_hold_tap_init, device_pm_control_nop, \ DEVICE_DT_INST_DEFINE(n, behavior_hold_tap_init, device_pm_control_nop, \
&behavior_hold_tap_data, &behavior_hold_tap_config_##n, APPLICATION, \ &behavior_hold_tap_data, &behavior_hold_tap_config_##n, APPLICATION, \