From feb0d5b90cbbb1a1026bf356afd788c860824ccf Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Fri, 11 Dec 2020 23:24:44 +0100 Subject: feat(combos): initial implementation closes #45 --- .../combo/combos-and-holdtaps-0/events.patterns | 2 + .../combos-and-holdtaps-0/keycode_events.snapshot | 4 ++ .../combos-and-holdtaps-0/native_posix.keymap | 47 ++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 app/tests/combo/combos-and-holdtaps-0/events.patterns create mode 100644 app/tests/combo/combos-and-holdtaps-0/keycode_events.snapshot create mode 100644 app/tests/combo/combos-and-holdtaps-0/native_posix.keymap (limited to 'app/tests/combo/combos-and-holdtaps-0') diff --git a/app/tests/combo/combos-and-holdtaps-0/events.patterns b/app/tests/combo/combos-and-holdtaps-0/events.patterns new file mode 100644 index 0000000..b90d786 --- /dev/null +++ b/app/tests/combo/combos-and-holdtaps-0/events.patterns @@ -0,0 +1,2 @@ +s/.*hid_listener_keycode_//p +s/.*combo//p \ No newline at end of file diff --git a/app/tests/combo/combos-and-holdtaps-0/keycode_events.snapshot b/app/tests/combo/combos-and-holdtaps-0/keycode_events.snapshot new file mode 100644 index 0000000..ad86b26 --- /dev/null +++ b/app/tests/combo/combos-and-holdtaps-0/keycode_events.snapshot @@ -0,0 +1,4 @@ +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0x1c mods 0x00 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0x1c mods 0x00 diff --git a/app/tests/combo/combos-and-holdtaps-0/native_posix.keymap b/app/tests/combo/combos-and-holdtaps-0/native_posix.keymap new file mode 100644 index 0000000..d35c727 --- /dev/null +++ b/app/tests/combo/combos-and-holdtaps-0/native_posix.keymap @@ -0,0 +1,47 @@ +#include +#include +#include + +&mt { + flavor = "hold-preferred"; +}; + +/* +This test fails if the order of event handlers for hold-taps +and combos is wrong. Hold-taps need to process key position events +first so the decision to hold or tap can be made. +*/ +/ { + combos { + compatible = "zmk,combos"; + + combo_two { + timeout-ms = <100>; + key-positions = <1 2>; + bindings = <&kp Y>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &mt LEFT_CONTROL A &kp B + &kp C &none + >; + }; + }; +}; + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_PRESS(0,2,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_RELEASE(0,2,10) + >; +}; \ No newline at end of file -- cgit v1.2.3