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:
Peter Johanson
2022-03-12 15:15:39 +00:00
committed by Pete Johanson
parent 58c7c0ee0c
commit 3a6a249ad0
36 changed files with 732 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
s/.*hid_listener_keycode/kp/p
s/.*behavior_queue_process_next/queue_process_next/p
s/.*queue_macro/qm/p

View File

@@ -0,0 +1,16 @@
qm: Iterating macro bindings - starting: 0, count: 4
queue_process_next: Invoking KEY_PRESS: 0x700e2 0x00
kp_pressed: usage_page 0x07 keycode 0xe2 implicit_mods 0x00 explicit_mods 0x00
queue_process_next: Processing next queued behavior in 10ms
queue_process_next: Invoking KEY_PRESS: 0x7002b 0x00
kp_pressed: usage_page 0x07 keycode 0x2b implicit_mods 0x00 explicit_mods 0x00
queue_process_next: Processing next queued behavior in 40ms
queue_process_next: Invoking KEY_PRESS: 0x7002b 0x00
kp_released: usage_page 0x07 keycode 0x2b implicit_mods 0x00 explicit_mods 0x00
queue_process_next: Processing next queued behavior in 10ms
kp_pressed: usage_page 0x07 keycode 0x2b implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x2b implicit_mods 0x00 explicit_mods 0x00
qm: Iterating macro bindings - starting: 5, count: 2
queue_process_next: Invoking KEY_PRESS: 0x700e2 0x00
kp_released: usage_page 0x07 keycode 0xe2 implicit_mods 0x00 explicit_mods 0x00
queue_process_next: Processing next queued behavior in 0ms

View File

@@ -0,0 +1,14 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_PRESS(0,0,400) ZMK_MOCK_PRESS(1,0,400) ZMK_MOCK_RELEASE(1,0,10) ZMK_MOCK_RELEASE(0,0,1000) ZMK_MOCK_RELEASE(0,1,1000)>;
};