From 76a6d7b4c5c18b64f36a421f3faca81f311ed465 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Wed, 11 Nov 2020 22:09:08 +0100 Subject: feat(sticky keys): initial implementation --- app/tests/sticky-keys/1-os-dn-up/events.patterns | 1 + .../sticky-keys/1-os-dn-up/keycode_events.snapshot | 4 ++++ .../sticky-keys/1-os-dn-up/native_posix.keymap | 13 +++++++++++++ .../2-os-dn-up-kcdn-kcup/events.patterns | 1 + .../2-os-dn-up-kcdn-kcup/keycode_events.snapshot | 4 ++++ .../2-os-dn-up-kcdn-kcup/native_posix.keymap | 13 +++++++++++++ .../3a-os-dn-kcdn-kcup-up/events.patterns | 1 + .../3a-os-dn-kcdn-kcup-up/keycode_events.snapshot | 4 ++++ .../3a-os-dn-kcdn-kcup-up/native_posix.keymap | 13 +++++++++++++ .../3b-os-dn-kcdn-up-kcup/events.patterns | 1 + .../3b-os-dn-kcdn-up-kcup/keycode_events.snapshot | 4 ++++ .../3b-os-dn-kcdn-up-kcup/native_posix.keymap | 13 +++++++++++++ .../4-os-dn-up-kcdn-timer-kcup/events.patterns | 1 + .../keycode_events.snapshot | 4 ++++ .../4-os-dn-up-kcdn-timer-kcup/native_posix.keymap | 13 +++++++++++++ .../5-os-kcdn-dn-kcup-up/events.patterns | 1 + .../5-os-kcdn-dn-kcup-up/keycode_events.snapshot | 4 ++++ .../5-os-kcdn-dn-kcup-up/native_posix.keymap | 13 +++++++++++++ .../events.patterns | 1 + .../keycode_events.snapshot | 6 ++++++ .../native_posix.keymap | 15 +++++++++++++++ app/tests/sticky-keys/behavior_keymap.dtsi | 22 ++++++++++++++++++++++ 22 files changed, 152 insertions(+) create mode 100644 app/tests/sticky-keys/1-os-dn-up/events.patterns create mode 100644 app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot create mode 100644 app/tests/sticky-keys/1-os-dn-up/native_posix.keymap create mode 100644 app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/events.patterns create mode 100644 app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot create mode 100644 app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap create mode 100644 app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/events.patterns create mode 100644 app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap create mode 100644 app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/events.patterns create mode 100644 app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot create mode 100644 app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap create mode 100644 app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/events.patterns create mode 100644 app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot create mode 100644 app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap create mode 100644 app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/events.patterns create mode 100644 app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot create mode 100644 app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap create mode 100644 app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/events.patterns create mode 100644 app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot create mode 100644 app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap create mode 100644 app/tests/sticky-keys/behavior_keymap.dtsi (limited to 'app/tests') diff --git a/app/tests/sticky-keys/1-os-dn-up/events.patterns b/app/tests/sticky-keys/1-os-dn-up/events.patterns new file mode 100644 index 0000000..833100f --- /dev/null +++ b/app/tests/sticky-keys/1-os-dn-up/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot b/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot new file mode 100644 index 0000000..5280f5c --- /dev/null +++ b/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot @@ -0,0 +1,4 @@ +pressed: usage_page 0x07 keycode 0x08 mods 0x00 +released: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x00 diff --git a/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap b/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap new file mode 100644 index 0000000..dd2e6ea --- /dev/null +++ b/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,1200) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/events.patterns b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/events.patterns new file mode 100644 index 0000000..833100f --- /dev/null +++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot new file mode 100644 index 0000000..758ed61 --- /dev/null +++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot @@ -0,0 +1,4 @@ +pressed: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x08 mods 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x00 diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap new file mode 100644 index 0000000..588f6a1 --- /dev/null +++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/events.patterns b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/events.patterns new file mode 100644 index 0000000..833100f --- /dev/null +++ b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot new file mode 100644 index 0000000..ee8aee0 --- /dev/null +++ b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot @@ -0,0 +1,4 @@ +pressed: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x08 mods 0x00 diff --git a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap new file mode 100644 index 0000000..3c33908 --- /dev/null +++ b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/events.patterns b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/events.patterns new file mode 100644 index 0000000..833100f --- /dev/null +++ b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot new file mode 100644 index 0000000..758ed61 --- /dev/null +++ b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot @@ -0,0 +1,4 @@ +pressed: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x08 mods 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x00 diff --git a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap new file mode 100644 index 0000000..e9290a3 --- /dev/null +++ b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/events.patterns b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/events.patterns new file mode 100644 index 0000000..833100f --- /dev/null +++ b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot new file mode 100644 index 0000000..758ed61 --- /dev/null +++ b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot @@ -0,0 +1,4 @@ +pressed: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x08 mods 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x00 diff --git a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap new file mode 100644 index 0000000..84daad6 --- /dev/null +++ b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,800) + ZMK_MOCK_PRESS(1,0,400) + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/events.patterns b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/events.patterns new file mode 100644 index 0000000..833100f --- /dev/null +++ b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot new file mode 100644 index 0000000..99bac8d --- /dev/null +++ b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot @@ -0,0 +1,4 @@ +pressed: usage_page 0x07 keycode 0x04 mods 0x00 +pressed: usage_page 0x07 keycode 0x08 mods 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x08 mods 0x00 diff --git a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap new file mode 100644 index 0000000..71a0a1b --- /dev/null +++ b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap @@ -0,0 +1,13 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,1100) + >; +}; \ No newline at end of file diff --git a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/events.patterns b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/events.patterns new file mode 100644 index 0000000..833100f --- /dev/null +++ b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot new file mode 100644 index 0000000..a9de7e1 --- /dev/null +++ b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot @@ -0,0 +1,6 @@ +pressed: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x04 mods 0x00 +pressed: usage_page 0x07 keycode 0x05 mods 0x00 +released: usage_page 0x07 keycode 0x08 mods 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x05 mods 0x00 diff --git a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap new file mode 100644 index 0000000..7a9901b --- /dev/null +++ b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap @@ -0,0 +1,15 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(1,1,10) + ZMK_MOCK_RELEASE(1,0,100) + ZMK_MOCK_RELEASE(1,1,100) + >; +}; \ No newline at end of file diff --git a/app/tests/sticky-keys/behavior_keymap.dtsi b/app/tests/sticky-keys/behavior_keymap.dtsi new file mode 100644 index 0000000..ae46396 --- /dev/null +++ b/app/tests/sticky-keys/behavior_keymap.dtsi @@ -0,0 +1,22 @@ +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &sk E &mo 1 + &kp A &kp B>; + }; + + lower_layer { + bindings = < + &sk LEFT_CONTROL &kp X + &kp Y &kp Z>; + }; + }; +}; -- cgit v1.2.3