* Add two new compatibles for macros that take one or two parameters when bound in a keymap. * Use `¯o_param_1to1`, `¯o_param_1to2`, `¯o_param_2to1`, and `¯o_param_2to2` control entries in the bindings for the macro to have the next binding entry have it's values substituted. Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
63 lines
No EOL
1.7 KiB
Text
63 lines
No EOL
1.7 KiB
Text
/*
|
|
* Copyright (c) 2022 The ZMK Contributors
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <dt-bindings/zmk/keys.h>
|
|
#include <behaviors.dtsi>
|
|
#include <dt-bindings/zmk/kscan_mock.h>
|
|
|
|
/ {
|
|
macros {
|
|
slash_macro: slash_macro {
|
|
#binding-cells = <2>;
|
|
label = "ZM_SLASH";
|
|
compatible = "zmk,behavior-macro-two-param";
|
|
wait-ms = <40>;
|
|
tap-ms = <40>;
|
|
bindings = <
|
|
¯o_param_1to1 &kp MACRO_PLACEHOLDER
|
|
&kp SLASH
|
|
¯o_param_2to1 &kp MACRO_PLACEHOLDER>;
|
|
};
|
|
|
|
to_second_macro: to_second_macro {
|
|
#binding-cells = <2>;
|
|
label = "ZMK_TO_SECOND";
|
|
compatible = "zmk,behavior-macro-two-param";
|
|
wait-ms = <40>;
|
|
tap-ms = <40>;
|
|
bindings = <
|
|
¯o_param_1to2 &mt LSHIFT MACRO_PLACEHOLDER
|
|
¯o_param_2to2 &mt RSHIFT MACRO_PLACEHOLDER>;
|
|
};
|
|
|
|
quote_letter_macro: quote_letter_macro {
|
|
#binding-cells = <1>;
|
|
label = "ZMK_QLET";
|
|
compatible = "zmk,behavior-macro-one-param";
|
|
wait-ms = <40>;
|
|
tap-ms = <40>;
|
|
bindings = <
|
|
&kp QUOT
|
|
¯o_param_1to1 &kp MACRO_PLACEHOLDER
|
|
&kp QUOT>;
|
|
};
|
|
};
|
|
|
|
keymap {
|
|
compatible = "zmk,keymap";
|
|
label = "Default keymap";
|
|
|
|
default_layer {
|
|
bindings = <
|
|
&slash_macro A B "e_letter_macro B
|
|
&to_second_macro E F &kp C>;
|
|
};
|
|
};
|
|
};
|
|
|
|
&kscan {
|
|
events = <ZMK_MOCK_PRESS(0,0,20) 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_RELEASE(1,0,1000)>;
|
|
}; |