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>;
};
};
};

View file

@ -8,44 +8,51 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
#define BASE 0
#define RAISE 1
/ {
macros {
abc_macro: abc_macro {
label = "ABCs";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings = <&kp A &kp B &kp C>;
};
hold_shift_macro: hold_shift_macro {
label = "HOLD_SHFT";
shift_layer_macro: shift_layer_macro {
label = "SHIFT_LAYER_MACRO";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
wait-ms = <1>;
bindings
= <&macro_press &kp LSHFT>
, <&macro_tap>
, <&kp D &kp O &kp G>
, <&macro_release &kp LSHFT>
// 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>
;
};
};
};
behaviors {
mth: macro_tap_hold {
compatible = "zmk,behavior-hold-tap";
label = "MACRO_TAP_HOLD";
#binding-cells = <2>;
flavor = "tap-unless-interrupted";
tapping-term-ms = <200>;
bindings = <&shift_layer_macro>, <&kp>;
};
};
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
base_layer {
bindings = <
&abc_macro &mo 1
&hold_shift_macro &custom_timing>;
&mth A B &kp C
&shift_layer_macro &kp D>;
};
extra_layer {
raise_layer {
bindings = <
&dual_sequence_macro &trans
&kp TAB &none>;
&mth L M &kp N
&kp O &kp P>;
};
};
};

View file

@ -1 +1,2 @@
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
kp_released: usage_page 0x07 keycode 0x04 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
mo_pressed: position 0 layer 1
kp_pressed: usage_page 0x07 keycode 0xe1 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
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 <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
#include "../behavior_keymap.dtsi"
#include "behavior_keymap.dtsi"
&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)
>;
};