/*
 * Copyright (c) 2021 The ZMK Contributors
 *
 * SPDX-License-Identifier: MIT
 */

#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>

#define LOWER 1
#define RAISE 2

#define L_SPC &lt LOWER SPACE
#define R_RET &lt RAISE RET

/ {
    keymap {
        compatible = "zmk,keymap";

        default_layer {
            display-name = "Default Layer";
            bindings = <
&kp ESC      &kp Q     &kp W     &kp E     &kp R     &kp T            &kp Y     &kp U     &kp I     &kp O    &kp P       &kp MINUS
&kp TAB      &kp A     &kp S     &kp D     &kp F     &kp G  &kp BSPC  &kp H     &kp J     &kp K     &kp L    &kp SEMI    &kp RSHFT
&kp LCTRL    &kp Z     &kp X     &kp C     &kp V     &kp B            &kp N     &kp M     &kp COMMA &kp DOT  &kp FSLH    &kp RCTRL
                              &kp LGUI  &kp LANG2    L_SPC            R_RET     &kp LANG1 &kp RALT
                                        &bt BT_CLR   &out OUT_TOG     &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2
            >;
        };
        lower_layer {
            display-name = "Lower Layer";
            bindings = <
&trans      &none     &none     &none     &none     &none            &none     &kp EQUAL &kp PLUS  &kp STAR &kp PRCNT   &trans
&trans      &kp N1    &kp N2    &kp N3    &kp N4    &kp N5 &trans    &kp N6    &kp N7    &kp N8    &kp N9   &kp N0      &trans
&trans      &none     &none     &none     &none     &none            &none     &none     &trans    &trans   &trans      &trans
                                &trans    &trans    &trans           &trans    &trans    &trans
                                          &trans    &trans           &trans    &trans    &trans
            >;
        };
        raise_layer {
            display-name = "Raise Layer";
            bindings = <
&trans      &kp BSLH  &kp EXCL  &kp AMPS  &kp PIPE  &none            &none     &kp EQUAL &kp PLUS  &kp STAR &kp PRCNT   &trans
&trans      &kp HASH  &kp GRAVE &kp DQT   &kp SQT   &kp TILDE &trans &kp LEFT  &kp DOWN  &kp UP    &kp RIGHT &kp DLLR   &trans
&trans      &none     &none     &kp LBRC  &kp LBKT  &kp LPAR         &kp RPAR  &kp RBKT  &kp RBRC  &kp AT    &kp CARET  &trans
                                &trans    &trans    &trans           &trans    &trans    &trans
                                          &trans    &trans           &trans    &trans    &trans
            >;
        };
    };
};
