diff options
author | Okke Formsma <[email protected]> | 2020-12-26 14:46:56 +0100 |
---|---|---|
committer | Pete Johanson <[email protected]> | 2021-01-22 19:27:18 -0500 |
commit | 5eeb310b2f0ccf1adf91b448573001559696a1d7 (patch) | |
tree | a3a711afe29b2df3dc781a8103ce58b21626433c /app/tests/gresc | |
parent | 58ad5d4e865341e736f4f80e6c3ec31d168fc509 (diff) | |
download | zmk-5eeb310b2f0ccf1adf91b448573001559696a1d7.tar.gz zmk-5eeb310b2f0ccf1adf91b448573001559696a1d7.zip |
feat(grave-escape): implement grave-escape
closes #85
Diffstat (limited to 'app/tests/gresc')
6 files changed, 119 insertions, 0 deletions
diff --git a/app/tests/gresc/gresc-press-release/events.patterns b/app/tests/gresc/gresc-press-release/events.patterns new file mode 100644 index 0000000000..b1342af4d9 --- /dev/null +++ b/app/tests/gresc/gresc-press-release/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p diff --git a/app/tests/gresc/gresc-press-release/keycode_events.snapshot b/app/tests/gresc/gresc-press-release/keycode_events.snapshot new file mode 100644 index 0000000000..ebeba596a2 --- /dev/null +++ b/app/tests/gresc/gresc-press-release/keycode_events.snapshot @@ -0,0 +1,18 @@ +pressed: usage_page 0x07 keycode 0x29 mods 0x00 +released: usage_page 0x07 keycode 0x29 mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0x35 mods 0x00 +released: usage_page 0x07 keycode 0x35 mods 0x00 +released: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0xe3 mods 0x00 +pressed: usage_page 0x07 keycode 0x35 mods 0x00 +released: usage_page 0x07 keycode 0x35 mods 0x00 +released: usage_page 0x07 keycode 0xe3 mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0x35 mods 0x00 +released: usage_page 0x07 keycode 0xe1 mods 0x00 +released: usage_page 0x07 keycode 0x35 mods 0x00 +pressed: usage_page 0x07 keycode 0xe3 mods 0x00 +pressed: usage_page 0x07 keycode 0x35 mods 0x00 +released: usage_page 0x07 keycode 0xe3 mods 0x00 +released: usage_page 0x07 keycode 0x35 mods 0x00 diff --git a/app/tests/gresc/gresc-press-release/native_posix.keymap b/app/tests/gresc/gresc-press-release/native_posix.keymap new file mode 100644 index 0000000000..7ca3d77dfb --- /dev/null +++ b/app/tests/gresc/gresc-press-release/native_posix.keymap @@ -0,0 +1,49 @@ +#include <dt-bindings/zmk/keys.h> +#include <behaviors.dtsi> +#include <dt-bindings/zmk/kscan-mock.h> + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &gresc &none + &kp LEFT_SHIFT &kp LEFT_GUI + >; + }; + }; +}; + +&kscan { + events = < + /* esc */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + + /* ~ */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(1,0,10) + + /* LGUI+` */ + ZMK_MOCK_PRESS(1,1,10) + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(1,1,10) + + /* ~ */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + + /* LGUI+` */ + ZMK_MOCK_PRESS(1,1,10) + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(1,1,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +};
\ No newline at end of file diff --git a/app/tests/gresc/gresc-two-instances/events.patterns b/app/tests/gresc/gresc-two-instances/events.patterns new file mode 100644 index 0000000000..ef7b795571 --- /dev/null +++ b/app/tests/gresc/gresc-two-instances/events.patterns @@ -0,0 +1,2 @@ +s/.*hid_listener_keycode_//p +s/.*on_mod_morph_binding_/morph_binding_/p
\ No newline at end of file diff --git a/app/tests/gresc/gresc-two-instances/keycode_events.snapshot b/app/tests/gresc/gresc-two-instances/keycode_events.snapshot new file mode 100644 index 0000000000..170e0cb1dc --- /dev/null +++ b/app/tests/gresc/gresc-two-instances/keycode_events.snapshot @@ -0,0 +1,6 @@ +pressed: usage_page 0x07 keycode 0x29 mods 0x00 +released: usage_page 0x07 keycode 0x29 mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0x35 mods 0x00 +released: usage_page 0x07 keycode 0xe1 mods 0x00 +released: usage_page 0x07 keycode 0x35 mods 0x00 diff --git a/app/tests/gresc/gresc-two-instances/native_posix.keymap b/app/tests/gresc/gresc-two-instances/native_posix.keymap new file mode 100644 index 0000000000..0c38721de3 --- /dev/null +++ b/app/tests/gresc/gresc-two-instances/native_posix.keymap @@ -0,0 +1,43 @@ +#include <dt-bindings/zmk/keys.h> +#include <behaviors.dtsi> +#include <dt-bindings/zmk/kscan-mock.h> + +/* +This test checks nothing breaks if two grave-escapes are pressed at the same time. +If someone ever really needs two, they can make a second behavior definition. + +The second gresc that is pressed is ignored. +The first gresc that is released releases the key. +*/ + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &gresc &gresc + &kp LEFT_SHIFT &kp LEFT_GUI + >; + }; + }; +}; + +&kscan { + events = < + /* esc */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(0,1,10) /* the second gresc is ignored */ + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(0,1,10) /* the second gresc is ignored */ + + /* ~ */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_PRESS(0,0,10) /* the second gresc is ignored */ + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_RELEASE(0,0,10) /* the second gresc is ignored */ + >; +};
\ No newline at end of file |