File tree Expand file tree Collapse file tree 4 files changed +60
-1
lines changed
tests/macros/param-then-no-param Expand file tree Collapse file tree 4 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,9 @@ static int behavior_macro_init(const struct device *dev) {
129129 LOG_DBG ("Release will resume at %d" , state -> release_state .start_index );
130130 break ;
131131 } else {
132- // Ignore regular invokable bindings
132+ // Mostly ignore regular invokable bindings, except they will consume macro parameters
133+ state -> release_state .param1_source = PARAM_SOURCE_BINDING ;
134+ state -> release_state .param2_source = PARAM_SOURCE_BINDING ;
133135 }
134136 }
135137
Original file line number Diff line number Diff line change 1+ s/.*hid_listener_keycode/kp/p
2+ s/.*mo_keymap_binding/mo/p
Original file line number Diff line number Diff line change 1+ kp_pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
2+ kp_released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
3+ mo_pressed: position 0 layer 1
4+ kp_pressed: usage_page 0x07 keycode 0x1C implicit_mods 0x00 explicit_mods 0x00
5+ kp_released: usage_page 0x07 keycode 0x1C implicit_mods 0x00 explicit_mods 0x00
6+ mo_released: position 0 layer 1
7+ kp_pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
8+ kp_released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
Original file line number Diff line number Diff line change 1+ #include <dt-bindings/zmk/keys.h>
2+ #include <behaviors.dtsi>
3+ #include <dt-bindings/zmk/kscan_mock.h>
4+
5+ / {
6+ macros {
7+ kp_l1: kp_l1 {
8+ compatible = "zmk,behavior-macro-one-param";
9+ #binding-cells = <1>;
10+ wait-ms = <5>;
11+ tap-ms = <5>;
12+ bindings
13+ = <¯o_param_1to1>
14+ , <¯o_tap &kp MACRO_PLACEHOLDER>
15+ , <¯o_press &mo 1>
16+ , <¯o_pause_for_release>
17+ , <¯o_release &mo 1>;
18+ };
19+ };
20+
21+ keymap {
22+ compatible = "zmk,keymap";
23+
24+ default_layer {
25+ bindings = <
26+ &kp_l1 A &kp B
27+ &kp C &none>;
28+ };
29+
30+ other_layer {
31+ bindings = <
32+ &kp X &kp Y
33+ &kp Z &none>;
34+ };
35+ };
36+ };
37+
38+ &kscan {
39+ events = <
40+ ZMK_MOCK_PRESS(0,0,20) // press macro (taps A)
41+ ZMK_MOCK_PRESS(0,1,20) // press Y
42+ ZMK_MOCK_RELEASE(0,1,20) // release Y
43+ ZMK_MOCK_RELEASE(0,0,20) // release macro
44+ ZMK_MOCK_PRESS(1,0,10) // press C
45+ ZMK_MOCK_RELEASE(1,0,10) // release C
46+ >;
47+ };
You can’t perform that action at this time.
0 commit comments