From 12fbc08bc2e8f257b13bd23168fdb558f0ebd1f1 Mon Sep 17 00:00:00 2001 From: Manna Harbour <51143715+manna-harbour@users.noreply.github.com> Date: Wed, 12 Jul 2023 22:33:02 +1000 Subject: [PATCH] Remove use of ZMK_MACRO --- miryoku/miryoku.h | 11 +++++++++++ miryoku/miryoku_kludge_tapdelay.h | 6 +----- miryoku/miryoku_mousekeys.dtsi | 10 +++------- miryoku/miryoku_shift_functions.dtsi | 6 +----- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/miryoku/miryoku.h b/miryoku/miryoku.h index ecbd6caff..9064b74c7 100644 --- a/miryoku/miryoku.h +++ b/miryoku/miryoku.h @@ -8,6 +8,17 @@ #define U_MACRO_VA_ARGS(macro, ...) macro(__VA_ARGS__) #define U_STRINGIFY(x) #x +#define U_MACRO(name,...) \ +/ { \ + macros { \ + name: name { \ + label = U_STRINGIFY(ZM_ ## name); \ + compatible = "zmk,behavior-macro"; \ + #binding-cells = <0>; \ + __VA_ARGS__ \ + }; \ + }; \ +}; #define U_NP &none // key is not present #define U_NA &none // present but not available for use diff --git a/miryoku/miryoku_kludge_tapdelay.h b/miryoku/miryoku_kludge_tapdelay.h index 939f89127..3f9be4cb6 100644 --- a/miryoku/miryoku_kludge_tapdelay.h +++ b/miryoku/miryoku_kludge_tapdelay.h @@ -4,11 +4,7 @@ #pragma once #define MIRYOKU_TAPDELAY_TAP(CODE) \ -/ { \ - macros { \ - ZMK_MACRO(u_tapdelay_tap_##CODE, bindings = <¯o_press &kp CODE>, <¯o_release &kp CODE>;) \ - }; \ -}; +U_MACRO(u_tapdelay_tap_##CODE, bindings = <¯o_press &kp CODE>, <¯o_release &kp CODE>;) #define MIRYOKU_TAPDELAY_MT(CODE) \ / { \ diff --git a/miryoku/miryoku_mousekeys.dtsi b/miryoku/miryoku_mousekeys.dtsi index b09ce6d85..d5894e040 100644 --- a/miryoku/miryoku_mousekeys.dtsi +++ b/miryoku/miryoku_mousekeys.dtsi @@ -1,10 +1,6 @@ // Copyright 2022 Manna Harbour // https://github.com/manna-harbour/miryoku -/ { - macros { - ZMK_MACRO(u_macro_btn1, wait-ms = <0>; bindings = <&kp KP_SLASH &kp KP_N5>;) - ZMK_MACRO(u_macro_btn2, wait-ms = <0>; bindings = <&kp KP_MINUS &kp KP_N5>;) - ZMK_MACRO(u_macro_btn3, wait-ms = <0>; bindings = <&kp KP_ASTERISK &kp KP_N5>;) - }; -}; +U_MACRO(u_macro_btn1, wait-ms = <0>; bindings = <&kp KP_SLASH &kp KP_N5>;) +U_MACRO(u_macro_btn2, wait-ms = <0>; bindings = <&kp KP_MINUS &kp KP_N5>;) +U_MACRO(u_macro_btn3, wait-ms = <0>; bindings = <&kp KP_ASTERISK &kp KP_N5>;) diff --git a/miryoku/miryoku_shift_functions.dtsi b/miryoku/miryoku_shift_functions.dtsi index 829504ed1..d53b40331 100644 --- a/miryoku/miryoku_shift_functions.dtsi +++ b/miryoku/miryoku_shift_functions.dtsi @@ -15,11 +15,7 @@ }; #define MIRYOKU_SHIFT_MACRO(NAME, BINDING, SHIFT_BINDING) \ -/ { \ - macros { \ - ZMK_MACRO(u_macro_ ## NAME, wait-ms = <0>; bindings = ;) \ - }; \ -}; \ +U_MACRO(u_macro_ ## NAME, wait-ms = <0>; bindings = ;) \ MIRYOKU_SHIFT_FUNCTION(NAME, BINDING, &u_macro_ ## NAME) MIRYOKU_SHIFT_MACRO(u_bt_sel_0, &bt BT_SEL 0, &bt BT_SEL 0 &bt BT_CLR)