forked from kofal.net/zmk
feat(behaviors): Add reusable sensor behaviors.
* Add new sensor behaviors that either take full bindings add definition, or accept parameters when bound in the keymap. * Remove existing hard-coded key press sensor behavior and instead leverage new generic sensor behaviors to achieve the same functionality. Co-authored-by: nick@conway.dev
This commit is contained in:
committed by
Pete Johanson
parent
9a73650041
commit
3db163aa2c
@@ -8,9 +8,10 @@
|
||||
behaviors {
|
||||
/* DEPRECATED: `inc_dec_cp` will be removed in the future */
|
||||
/omit-if-no-ref/ inc_dec_cp: inc_dec_kp: behavior_sensor_rotate_key_press {
|
||||
compatible = "zmk,behavior-sensor-rotate-key-press";
|
||||
compatible = "zmk,behavior-sensor-rotate-var";
|
||||
label = "ENC_KEY_PRESS";
|
||||
#sensor-binding-cells = <2>;
|
||||
bindings = <&kp>, <&kp>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Sensor rotate key press/release behavior
|
||||
|
||||
compatible: "zmk,behavior-sensor-rotate-key-press"
|
||||
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
required: true
|
||||
"#sensor-binding-cells":
|
||||
type: int
|
||||
required: true
|
||||
const: 2
|
||||
|
||||
sensor-binding-cells:
|
||||
- param1
|
||||
- param2
|
||||
@@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Sensor rotate behavior
|
||||
|
||||
compatible: "zmk,behavior-sensor-rotate-var"
|
||||
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
required: true
|
||||
"#sensor-binding-cells":
|
||||
type: int
|
||||
required: true
|
||||
const: 2
|
||||
bindings:
|
||||
type: phandles
|
||||
required: true
|
||||
tap-ms:
|
||||
type: int
|
||||
default: 5
|
||||
|
||||
sensor-binding-cells:
|
||||
- param1
|
||||
- param2
|
||||
21
app/dts/bindings/behaviors/zmk,behavior-sensor-rotate.yaml
Normal file
21
app/dts/bindings/behaviors/zmk,behavior-sensor-rotate.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Sensor rotate behavior
|
||||
|
||||
compatible: "zmk,behavior-sensor-rotate"
|
||||
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
required: true
|
||||
"#sensor-binding-cells":
|
||||
type: int
|
||||
required: true
|
||||
const: 0
|
||||
bindings:
|
||||
type: phandle-array
|
||||
required: true
|
||||
tap-ms:
|
||||
type: int
|
||||
default: 5
|
||||
Reference in New Issue
Block a user