diff options
author | Alexander Krikun <[email protected]> | 2021-04-27 18:24:11 +0300 |
---|---|---|
committer | Pete Johanson <[email protected]> | 2023-11-15 11:16:59 -0800 |
commit | d7d9eed317b3f788370a8728afa449c5e525f2ca (patch) | |
tree | 38e657065f64555fa90804dd1e4a145427271d19 /app/tests | |
parent | 8776911da5005d42cd0bdf108b23deca16d7ec82 (diff) | |
download | zmk-d7d9eed317b3f788370a8728afa449c5e525f2ca.tar.gz zmk-d7d9eed317b3f788370a8728afa449c5e525f2ca.zip |
feat(mouse): Initial mouse keys support.
* Add HID report/descriptor for a new report with mouse buttons,
and x/y/wheel deltas.
* New mouse key press behavior for press/release of mouse keys.
* Add constants for HID main item values (e.g. data/array/absolute)
* Define and use constants for our HID report IDs.
Diffstat (limited to 'app/tests')
-rw-r--r-- | app/tests/mouse-keys/mkp/events.patterns | 1 | ||||
-rw-r--r-- | app/tests/mouse-keys/mkp/keycode_events.snapshot | 10 | ||||
-rw-r--r-- | app/tests/mouse-keys/mkp/native_posix.keymap | 28 | ||||
-rw-r--r-- | app/tests/mouse-keys/mkp/native_posix_64.keymap | 28 |
4 files changed, 67 insertions, 0 deletions
diff --git a/app/tests/mouse-keys/mkp/events.patterns b/app/tests/mouse-keys/mkp/events.patterns new file mode 100644 index 0000000000..2599345c2d --- /dev/null +++ b/app/tests/mouse-keys/mkp/events.patterns @@ -0,0 +1 @@ +s/.*zmk_hid_mouse_button_//p diff --git a/app/tests/mouse-keys/mkp/keycode_events.snapshot b/app/tests/mouse-keys/mkp/keycode_events.snapshot new file mode 100644 index 0000000000..ab58cc9575 --- /dev/null +++ b/app/tests/mouse-keys/mkp/keycode_events.snapshot @@ -0,0 +1,10 @@ +press: Button 0 count 1 +press: Mouse buttons set to 0x01 +press: Button 1 count 1 +press: Mouse buttons set to 0x03 +release: Button 1 count: 0 +release: Button 1 released +release: Mouse buttons set to 0x01 +release: Button 0 count: 0 +release: Button 0 released +release: Mouse buttons set to 0x00 diff --git a/app/tests/mouse-keys/mkp/native_posix.keymap b/app/tests/mouse-keys/mkp/native_posix.keymap new file mode 100644 index 0000000000..04316eb34b --- /dev/null +++ b/app/tests/mouse-keys/mkp/native_posix.keymap @@ -0,0 +1,28 @@ +#include <behaviors.dtsi> +#include <dt-bindings/zmk/keys.h> +#include <dt-bindings/zmk/kscan_mock.h> +#include <dt-bindings/zmk/mouse.h> + +/ { + keymap { + compatible = "zmk,keymap"; + label = "Default keymap"; + + default_layer { + bindings = < + &mkp LCLK &none + &none &mkp RCLK + >; + }; + }; +}; + + +&kscan { + events = < + ZMK_MOCK_PRESS (0,0,100) + ZMK_MOCK_PRESS (1,1,100) + ZMK_MOCK_RELEASE(1,1, 10) + ZMK_MOCK_RELEASE(0,0, 10) + >; +}; diff --git a/app/tests/mouse-keys/mkp/native_posix_64.keymap b/app/tests/mouse-keys/mkp/native_posix_64.keymap new file mode 100644 index 0000000000..04316eb34b --- /dev/null +++ b/app/tests/mouse-keys/mkp/native_posix_64.keymap @@ -0,0 +1,28 @@ +#include <behaviors.dtsi> +#include <dt-bindings/zmk/keys.h> +#include <dt-bindings/zmk/kscan_mock.h> +#include <dt-bindings/zmk/mouse.h> + +/ { + keymap { + compatible = "zmk,keymap"; + label = "Default keymap"; + + default_layer { + bindings = < + &mkp LCLK &none + &none &mkp RCLK + >; + }; + }; +}; + + +&kscan { + events = < + ZMK_MOCK_PRESS (0,0,100) + ZMK_MOCK_PRESS (1,1,100) + ZMK_MOCK_RELEASE(1,1, 10) + ZMK_MOCK_RELEASE(0,0, 10) + >; +}; |