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

#include "zmk_uno.dtsi"

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

/ {
    chosen {
        zmk,physical-layout = &matrix_physical_layout;
    };

    sensors: sensors {
        compatible = "zmk,keymap-sensors";
        sensors = <&encoder>;
        triggers-per-rotation = <20>;
        left {
            triggers-per-rotation = <20>;
        };
    };

    macros {
        ZMK_MACRO(ble_zero,
            wait-ms = <1>;
            tap-ms = <1>;
            bindings = <&out OUT_BLE &bt BT_SEL 0>;
        )
        ZMK_MACRO(ble_one,
            wait-ms = <1>;
            tap-ms = <1>;
            bindings = <&out OUT_BLE &bt BT_SEL 1>;
        )
    };

    endpoint_sideband_behaviors {
        compatible = "zmk,kscan-sideband-behaviors";

        auto-enable;
        kscan = <&kscan_sp3t_toggle>;

        first_toggle_sideband: first_toggle_sideband {
            column = <0>;
            bindings = <&out OUT_USB>;
        };

        second_toggle_sideband: second_toggle_sideband {
            column = <1>;
            bindings = <&ble_zero>;
        };

        third_toggle_sideband: third_toggle_sideband {
            column = <2>;
            bindings = <&ble_one>;
        };
    };
};
