add compile-time hold_trigger_key_positions vs tap-positionally-preferred check

This commit is contained in:
jding 2021-10-30 15:29:41 +00:00
parent 63776e36b5
commit db71a8e692

View file

@ -657,7 +657,14 @@ static struct behavior_hold_tap_data behavior_hold_tap_data;
}; \ }; \
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, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_hold_tap_driver_api); CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_hold_tap_driver_api); \
BUILD_ASSERT((DT_ENUM_IDX(DT_DRV_INST(n), flavor) == 3 && \
!(DT_INST_PROP_LEN(n, hold_trigger_key_positions) > 0)), \
"'hold-trigger-key-positions' must be non-empty if hold-tap flavor is " \
"'tap-positionally-preferred'"); \
BUILD_ASSERT((DT_INST_PROP_LEN(n, hold_trigger_key_positions) > 0) \
&& DT_ENUM_IDX(DT_DRV_INST(n), flavor) != 3 ), \
"hold-tap flavor must be 'tap-positionally-preferred' if 'hold-trigger-key-positions' is non-empty");
DT_INST_FOREACH_STATUS_OKAY(KP_INST) DT_INST_FOREACH_STATUS_OKAY(KP_INST)