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

@@ -6,7 +6,7 @@
/ {
behaviors {
bt: behavior_bluetooth {
/omit-if-no-ref/ bt: behavior_bluetooth {
compatible = "zmk,behavior-bluetooth";
label = "BLUETOOTH";
#binding-cells = <2>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
ext_power: behavior_ext_power {
/omit-if-no-ref/ ext_power: behavior_ext_power {
compatible = "zmk,behavior-ext-power";
label = "EXT_POWER_BEHAVIOR";
#binding-cells = <1>;

View File

@@ -7,7 +7,7 @@
/ {
behaviors {
/* DEPRECATED: `cp` will be removed in the future */
cp: kp: behavior_key_press {
/omit-if-no-ref/ cp: kp: behavior_key_press {
compatible = "zmk,behavior-key-press";
label = "KEY_PRESS";
#binding-cells = <1>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
lt: behavior_layer_tap {
/omit-if-no-ref/ lt: behavior_layer_tap {
compatible = "zmk,behavior-hold-tap";
label = "LAYER_TAP";
#binding-cells = <2>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
mt: behavior_mod_tap {
/omit-if-no-ref/ mt: behavior_mod_tap {
compatible = "zmk,behavior-hold-tap";
label = "MOD_TAP";
#binding-cells = <2>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
mo: behavior_momentary_layer {
/omit-if-no-ref/ mo: behavior_momentary_layer {
compatible = "zmk,behavior-momentary-layer";
label = "MO";
#binding-cells = <1>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
none: behavior_none {
/omit-if-no-ref/ none: behavior_none {
compatible = "zmk,behavior-none";
label = "NONE";
#binding-cells = <0>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
out: behavior_outputs {
/omit-if-no-ref/ out: behavior_outputs {
compatible = "zmk,behavior-outputs";
label = "OUTPUTS";
#binding-cells = <1>;

View File

@@ -8,13 +8,13 @@
/ {
behaviors {
reset: behavior_reset {
/omit-if-no-ref/ reset: behavior_reset {
compatible = "zmk,behavior-reset";
label = "RESET";
#binding-cells = <0>;
};
bootloader: behavior_reset_dfu {
/omit-if-no-ref/ bootloader: behavior_reset_dfu {
compatible = "zmk,behavior-reset";
label = "BOOTLOADER_RESET";
type = <RST_UF2>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
rgb_ug: behavior_rgb_underglow {
/omit-if-no-ref/ rgb_ug: behavior_rgb_underglow {
compatible = "zmk,behavior-rgb-underglow";
label = "RGB_UNDERGLOW";
#binding-cells = <2>;

View File

@@ -7,7 +7,7 @@
/ {
behaviors {
/* DEPRECATED: `inc_dec_cp` will be removed in the future */
inc_dec_cp: inc_dec_kp: behavior_sensor_rotate_key_press {
/omit-if-no-ref/ inc_dec_cp: inc_dec_kp: behavior_sensor_rotate_key_press {
compatible = "zmk,behavior-sensor-rotate-key-press";
label = "ENC_KEY_PRESS";
#sensor-binding-cells = <2>;

View File

@@ -6,14 +6,14 @@
/ {
behaviors {
sk: behavior_sticky_key {
/omit-if-no-ref/ sk: behavior_sticky_key {
compatible = "zmk,behavior-sticky-key";
label = "STICKY_KEY";
#binding-cells = <1>;
release-after-ms = <1000>;
bindings = <&kp>;
};
sl: behavior_sticky_layer {
/omit-if-no-ref/ sl: behavior_sticky_layer {
compatible = "zmk,behavior-sticky-key";
label = "STICKY_LAYER";
#binding-cells = <1>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
to: behavior_to_layer {
/omit-if-no-ref/ to: behavior_to_layer {
compatible = "zmk,behavior-to-layer";
label = "TO_LAYER";
#binding-cells = <1>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
tog: behavior_toggle_layer {
/omit-if-no-ref/ tog: behavior_toggle_layer {
compatible = "zmk,behavior-toggle-layer";
label = "TOGGLE_LAYER";
#binding-cells = <1>;

View File

@@ -6,7 +6,7 @@
/ {
behaviors {
trans: behavior_transparent {
/omit-if-no-ref/ trans: behavior_transparent {
compatible = "zmk,behavior-transparent";
label = "TRANS";
#binding-cells = <0>;