forked from kofal.net/zmk
feat(behaviors): Add macro support.
* Fine grainted press/release/tap actions. * TIming between actions can be controlled. * Processed async, to avoid blocking.
This commit is contained in:
committed by
Pete Johanson
parent
58c7c0ee0c
commit
3a6a249ad0
@@ -17,3 +17,4 @@
|
||||
#include <behaviors/caps_word.dtsi>
|
||||
#include <behaviors/key_repeat.dtsi>
|
||||
#include <behaviors/backlight.dtsi>
|
||||
#include <behaviors/macros.dtsi>
|
||||
54
app/dts/behaviors/macros.dtsi
Normal file
54
app/dts/behaviors/macros.dtsi
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2022 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#define ZMK_MACRO_STRINGIFY(x) #x
|
||||
#define ZMK_MACRO(name,...) \
|
||||
name: name { \
|
||||
label = ZMK_MACRO_STRINGIFY(ZM_ ## name); \
|
||||
compatible = "zmk,behavior-macro"; \
|
||||
#binding-cells = <0>; \
|
||||
__VA_ARGS__ \
|
||||
};
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
macro_tap: macro_control_mode_tap {
|
||||
compatible = "zmk,macro-control-mode-tap";
|
||||
label = "MAC_TAP";
|
||||
#binding-cells = <0>;
|
||||
};
|
||||
|
||||
macro_press: macro_control_mode_press {
|
||||
compatible = "zmk,macro-control-mode-press";
|
||||
label = "MAC_PRESS";
|
||||
#binding-cells = <0>;
|
||||
};
|
||||
|
||||
macro_release: macro_control_mode_release {
|
||||
compatible = "zmk,macro-control-mode-release";
|
||||
label = "MAC_REL";
|
||||
#binding-cells = <0>;
|
||||
};
|
||||
|
||||
macro_tap_time: macro_control_tap_time {
|
||||
compatible = "zmk,macro-control-tap-time";
|
||||
label = "MAC_TAP_TIME";
|
||||
#binding-cells = <1>;
|
||||
};
|
||||
|
||||
macro_wait_time: macro_control_wait_time {
|
||||
compatible = "zmk,macro-control-wait-time";
|
||||
label = "MAC_WAIT_TIME";
|
||||
#binding-cells = <1>;
|
||||
};
|
||||
|
||||
macro_pause_for_release: macro_pause_for_release {
|
||||
compatible = "zmk,macro-pause-for-release";
|
||||
label = "MAC_WAIT_REL";
|
||||
#binding-cells = <0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
21
app/dts/bindings/behaviors/zmk,behavior-macro.yaml
Normal file
21
app/dts/bindings/behaviors/zmk,behavior-macro.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Macro Behavior
|
||||
|
||||
compatible: "zmk,behavior-macro"
|
||||
|
||||
include: zero_param.yaml
|
||||
|
||||
properties:
|
||||
bindings:
|
||||
type: phandle-array
|
||||
required: true
|
||||
wait-ms:
|
||||
type: int
|
||||
default: 100
|
||||
description: The default time to wait (in milliseconds) before triggering the next behavior in the macro bindings list.
|
||||
tap-ms:
|
||||
type: int
|
||||
default: 100
|
||||
description: The default time to wait (in milliseconds) between the press and release events on a tapped macro behavior binding
|
||||
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Set Macro To Press Mode
|
||||
|
||||
compatible: "zmk,macro-control-mode-press"
|
||||
|
||||
include: zero_param.yaml
|
||||
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Set Macro To Release Mode
|
||||
|
||||
compatible: "zmk,macro-control-mode-release"
|
||||
|
||||
include: zero_param.yaml
|
||||
8
app/dts/bindings/macros/zmk,macro-control-mode-tap.yaml
Normal file
8
app/dts/bindings/macros/zmk,macro-control-mode-tap.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Set Macro To Tap Mode
|
||||
|
||||
compatible: "zmk,macro-control-mode-tap"
|
||||
|
||||
include: zero_param.yaml
|
||||
8
app/dts/bindings/macros/zmk,macro-control-tap-time.yaml
Normal file
8
app/dts/bindings/macros/zmk,macro-control-tap-time.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Set Macro Tap Duration
|
||||
|
||||
compatible: "zmk,macro-control-tap-time"
|
||||
|
||||
include: one_param.yaml
|
||||
8
app/dts/bindings/macros/zmk,macro-control-wait-time.yaml
Normal file
8
app/dts/bindings/macros/zmk,macro-control-wait-time.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Set Macro Wait Duration
|
||||
|
||||
compatible: "zmk,macro-control-wait-time"
|
||||
|
||||
include: one_param.yaml
|
||||
8
app/dts/bindings/macros/zmk,macro-pause-for-release.yaml
Normal file
8
app/dts/bindings/macros/zmk,macro-pause-for-release.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2022 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
description: Macro Pause Until Release Marker
|
||||
|
||||
compatible: "zmk,macro-pause-for-release"
|
||||
|
||||
include: zero_param.yaml
|
||||
Reference in New Issue
Block a user