/*
 * 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>

#define BASE 0
#define RAISE 1

/ {
	macros {
        shift_layer_macro: shift_layer_macro {
			label = "SHIFT_LAYER_MACRO";
			compatible = "zmk,behavior-macro";
			#binding-cells = <0>;
			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>
				;
        };
	};


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

		base_layer {
			bindings = <
				&mth A B 			&kp C
				&shift_layer_macro  &kp D>;
		};

		raise_layer {
			bindings = <
				&mth L M 			&kp N
				&kp O				&kp P>;
		};
	};
};
