From dadf1e611f4a3a71607c52bbc5960f6b1e5d0a03 Mon Sep 17 00:00:00 2001 From: Sophie Tyalie Date: Thu, 17 Nov 2022 13:08:14 +0100 Subject: [PATCH] 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 = <¯o>, <&kp>; } } } ``` Additionally, there's now no standard definition flying around (deletion of `dts/behaviors/custom_lock.dtsi`) Signed-off-by: Sophie Tyalie --- app/dts/behaviors.dtsi | 1 - app/dts/behaviors/custom_lock.dtsi | 15 --------------- .../behaviors/zmk,behavior-custom-lock.yaml | 7 +++++-- 3 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 app/dts/behaviors/custom_lock.dtsi diff --git a/app/dts/behaviors.dtsi b/app/dts/behaviors.dtsi index 8fa30b34..58ee8359 100644 --- a/app/dts/behaviors.dtsi +++ b/app/dts/behaviors.dtsi @@ -19,4 +19,3 @@ #include #include #include -#include diff --git a/app/dts/behaviors/custom_lock.dtsi b/app/dts/behaviors/custom_lock.dtsi deleted file mode 100644 index aa791813..00000000 --- a/app/dts/behaviors/custom_lock.dtsi +++ /dev/null @@ -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>; - }; - }; -}; diff --git a/app/dts/bindings/behaviors/zmk,behavior-custom-lock.yaml b/app/dts/bindings/behaviors/zmk,behavior-custom-lock.yaml index 7ea9c5dc..34b67e17 100644 --- a/app/dts/bindings/behaviors/zmk,behavior-custom-lock.yaml +++ b/app/dts/bindings/behaviors/zmk,behavior-custom-lock.yaml @@ -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