Behavior: Change way lock keys are defined in dts

Previously the definition was copied almost 1:1 from the `none` behavior
in order to set up the important files and have a small running, but
featureless sample.

This change introduces a way to actually configure the custom lock
behavior, using the following syntax:

```
behaviors {
  dead_lock_prevent {
    compatible = "zmk,behavior-custom-lock";

    // to define a key
    dead: dead_key {
      #binding-cells = <2>;
      bindings = <&kp>, <&kp>;
    }

    // or to define a macro
    deadm: dead_macro {
      #binding-cells = <2>;
      bindings = <&macro>, <&kp>;
    }
  }
}
```

Additionally, there's now no standard definition flying around (deletion
of `dts/behaviors/custom_lock.dtsi`)

Signed-off-by: Sophie Tyalie <dev@flowerpot.me>
This commit is contained in:
Sophie Tyalie 2022-11-17 13:08:14 +01:00
parent 776b118d95
commit dadf1e611f
3 changed files with 5 additions and 18 deletions

View file

@ -19,4 +19,3 @@
#include <behaviors/key_repeat.dtsi>
#include <behaviors/backlight.dtsi>
#include <behaviors/macros.dtsi>
#include <behaviors/custom_lock.dtsi>

View file

@ -1,15 +0,0 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/ {
behaviors {
/omit-if-no-ref/ lock: behavior_custom_lock {
compatible = "zmk,behavior-custom-lock";
label = "CUSTOM LOCK";
#binding-cells = <0>;
};
};
};

View file

@ -1,8 +1,11 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
description: Custom Lock Behavior
description: Custom lock behavior variable definition
compatible: "zmk,behavior-custom-lock"
include: zero_param.yaml
child-binding:
description: Key definitions for lock variable
include: two_param.yaml