mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-20 04:55:20 -05:00
feat(behaviors): Adding global-quick-tap-ms for combos
This brings the 'global-quick-tap' functionality to combos by filtering out candidate combos that fell within their own quick tap term. I also replaced `return 0` with `return ZMK_EV_EVENT_BUBBLE` where appropriate. (I assume this was done in past as it is similar to errno returning, but being that this is to signify an event type I find this more clear)
This commit is contained in:
committed by
Pete Johanson
parent
2f6abff3bc
commit
77eb44ba9b
1
app/tests/combo/global-quick-tap/events.patterns
Normal file
1
app/tests/combo/global-quick-tap/events.patterns
Normal file
@@ -0,0 +1 @@
|
||||
s/.*hid_listener_keycode_//p
|
||||
14
app/tests/combo/global-quick-tap/keycode_events.snapshot
Normal file
14
app/tests/combo/global-quick-tap/keycode_events.snapshot
Normal file
@@ -0,0 +1,14 @@
|
||||
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||
pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
|
||||
pressed: usage_page 0x07 keycode 0x1B implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x1B implicit_mods 0x00 explicit_mods 0x00
|
||||
pressed: usage_page 0x07 keycode 0x1B implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x1B implicit_mods 0x00 explicit_mods 0x00
|
||||
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||
pressed: usage_page 0x07 keycode 0x1C implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x1C implicit_mods 0x00 explicit_mods 0x00
|
||||
64
app/tests/combo/global-quick-tap/native_posix_64.keymap
Normal file
64
app/tests/combo/global-quick-tap/native_posix_64.keymap
Normal file
@@ -0,0 +1,64 @@
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/kscan-mock.h>
|
||||
|
||||
/ {
|
||||
combos {
|
||||
compatible = "zmk,combos";
|
||||
combo_one {
|
||||
timeout-ms = <50>;
|
||||
key-positions = <0 1>;
|
||||
bindings = <&kp X>;
|
||||
global-quick-tap-ms = <100>;
|
||||
};
|
||||
|
||||
combo_two {
|
||||
timeout-ms = <50>;
|
||||
key-positions = <0 2>;
|
||||
bindings = <&kp Y>;
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
label ="Default keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&kp A &kp B
|
||||
&kp C &kp D
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&kscan {
|
||||
events = <
|
||||
/* Tap A */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,60)
|
||||
/* Quick Tap A and B */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_PRESS(0,1,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,1,200)
|
||||
/* Combo One */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_PRESS(0,1,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,1,10)
|
||||
/* Combo One Again (shouldn't quick tap) */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_PRESS(0,1,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,1,10)
|
||||
/* Tap A */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,60)
|
||||
/* Combo 2 */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_PRESS(1,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
ZMK_MOCK_RELEASE(1,0,10)
|
||||
>;
|
||||
};
|
||||
Reference in New Issue
Block a user