refactor(core): Use /omit-if-no-ref/ for behaviors.

* Use lesser-known DT features to skip behaviors not referenced
  in the user keymap
* Update the behaviors to skip code if no nodes found.
* Remove some empty config/data structs where unused in
  behaviors.
This commit is contained in:
Pete Johanson
2021-01-18 01:09:51 -05:00
parent b4d63fb52c
commit b84d29c384
26 changed files with 62 additions and 38 deletions

View File

@@ -15,6 +15,8 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int behavior_to_init(const struct device *dev) { return 0; };
static int to_keymap_binding_pressed(struct zmk_behavior_binding *binding,
@@ -37,3 +39,5 @@ static const struct behavior_driver_api behavior_to_driver_api = {
DEVICE_AND_API_INIT(behavior_to, DT_INST_LABEL(0), behavior_to_init, NULL, NULL, APPLICATION,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_to_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */