test macro from tap hold

This commit is contained in:
Jamie Ding 2022-03-20 01:44:49 +00:00
parent 971b018aec
commit ddc022c291
5 changed files with 52 additions and 30 deletions

View file

@ -72,6 +72,5 @@
&kp TAB &none>; &kp TAB &none>;
}; };
}; };
}; };

View file

@ -8,25 +8,34 @@
#include <behaviors.dtsi> #include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h> #include <dt-bindings/zmk/kscan_mock.h>
#define BASE 0
#define RAISE 1
/ { / {
macros { macros {
abc_macro: abc_macro { shift_layer_macro: shift_layer_macro {
label = "ABCs"; label = "SHIFT_LAYER_MACRO";
compatible = "zmk,behavior-macro"; compatible = "zmk,behavior-macro";
#binding-cells = <0>; #binding-cells = <0>;
bindings = <&kp A &kp B &kp C>; wait-ms = <1>;
bindings
// tog doesn't work, the tog on release doesn't seem to fire
= <&macro_press &mo RAISE &kp LSHFT>
, <&macro_pause_for_release>
, <&macro_release &mo RAISE &kp LSHFT>
;
};
}; };
hold_shift_macro: hold_shift_macro {
label = "HOLD_SHFT"; behaviors {
compatible = "zmk,behavior-macro"; mth: macro_tap_hold {
#binding-cells = <0>; compatible = "zmk,behavior-hold-tap";
bindings label = "MACRO_TAP_HOLD";
= <&macro_press &kp LSHFT> #binding-cells = <2>;
, <&macro_tap> flavor = "tap-unless-interrupted";
, <&kp D &kp O &kp G> tapping-term-ms = <200>;
, <&macro_release &kp LSHFT> bindings = <&shift_layer_macro>, <&kp>;
;
}; };
}; };
@ -34,18 +43,16 @@
compatible = "zmk,keymap"; compatible = "zmk,keymap";
label ="Default keymap"; label ="Default keymap";
default_layer { base_layer {
bindings = < bindings = <
&abc_macro &mo 1 &mth A B &kp C
&hold_shift_macro &custom_timing>; &shift_layer_macro &kp D>;
}; };
extra_layer { raise_layer {
bindings = < bindings = <
&dual_sequence_macro &trans &mth L M &kp N
&kp TAB &none>; &kp O &kp P>;
}; };
}; };
}; };

View file

@ -1 +1,2 @@
s/.*hid_listener_keycode/kp/p s/.*hid_listener_keycode/kp/p
s/.*mo_keymap_binding/mo/p

View file

@ -1,6 +1,6 @@
kp_pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 mo_pressed: position 0 layer 1
kp_released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
kp_pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00 kp_pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00 kp_released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
mo_released: position 0 layer 1
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00

View file

@ -7,8 +7,23 @@
#include <dt-bindings/zmk/keys.h> #include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi> #include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h> #include <dt-bindings/zmk/kscan_mock.h>
#include "../behavior_keymap.dtsi" #include "behavior_keymap.dtsi"
&kscan { &kscan {
events = <ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,1000)>; events = <
ZMK_MOCK_PRESS( 1,1,10)
ZMK_MOCK_PRESS( 0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
ZMK_MOCK_RELEASE(1,1,10)
//ZMK_MOCK_PRESS( 0,0,10)
//ZMK_MOCK_PRESS( 0,1,10)
//ZMK_MOCK_RELEASE(0,1,10)
//ZMK_MOCK_RELEASE(0,0,10)
//
//ZMK_MOCK_PRESS( 1,0,10)
//ZMK_MOCK_PRESS( 1,1,10)
//ZMK_MOCK_RELEASE(1,1,10)
//ZMK_MOCK_RELEASE(1,0,10)
>;
}; };