Skip to content

Commit 5edaaf5

Browse files
committed
test(behaviors): Add parametrized macro test that fails
1 parent cef7af4 commit 5edaaf5

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
s/.*hid_listener_keycode/kp/p
2+
s/.*mo_keymap_binding/mo/p
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
= <&macro_param_1to1>
14+
, <&macro_tap &kp MACRO_PLACEHOLDER>
15+
, <&macro_press &mo 1>
16+
, <&macro_pause_for_release>
17+
, <&macro_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+
};

0 commit comments

Comments
 (0)