zmk-config/config/cradio.keymap
2024-10-05 15:21:25 -05:00

152 lines
14 KiB
Plaintext

// Copyright (c) 2022 The ZMK Contributors
// SPDX-License-Identifier: MIT
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
// Home row mods macro
#define HRML(k1,k2,k3,k4) &ht LSHFT k1 &ht LALT k2 &ht LCTRL k3 &ht LGUI k4
#define HRMR(k1,k2,k3,k4) &ht RGUI k1 &ht RCTRL k2 &ht RALT k3 &ht RSHFT k4
/ {
left_key_matrix {
compatible = "zmk,matrix-transform";
rows = <4>; // 3 rows
columns = <6>; // 3 columns
row-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>, // Pin for row 1
<&gpio0 0 GPIO_ACTIVE_LOW>, // Pin for row 2
<&gpio0 2 GPIO_ACTIVE_LOW>, // Pin for row 3
<&gpio0 3 GPIO_ACTIVE_LOW>; // Pin for row 4
col-gpios = <&gpio0 19 GPIO_ACTIVE_LOW>, // Pin for column 1
<&gpio0 18 GPIO_ACTIVE_LOW>, // Pin for column 2
<&gpio0 15 GPIO_ACTIVE_LOW>, // Pin for column 3
<&gpio0 14 GPIO_ACTIVE_LOW>, // Pin for column 4
<&gpio0 16 GPIO_ACTIVE_LOW>, // Pin for column 5
<&gpio0 10 GPIO_ACTIVE_LOW>; // Pin for column 6
// The map property defines the row/column positions for the key matrix
map = <0 0>, <0 1>, <0 2>, <0 3>, <0 4>, // Row 0
<1 0>, <1 1>, <1 2>, <1 3>, <1 4>, // Row 1
<2 0>, <2 1>, <2 2>, <2 3>, <2 4>, // Row 2
<3 3>, <3 4>, <3 5>; // Row 3 aka thumb cluster
};
right_key_matrix {
compatible = "zmk,matrix-transform";
rows = <4>; // 3 rows
columns = <6>; // 3 columns
row-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>, // Pin for row 1
<&gpio0 0 GPIO_ACTIVE_LOW>, // Pin for row 2
<&gpio0 2 GPIO_ACTIVE_LOW>, // Pin for row 3
<&gpio0 3 GPIO_ACTIVE_LOW>; // Pin for row 4
col-gpios = <&gpio0 19 GPIO_ACTIVE_LOW>, // Pin for column 1
<&gpio0 18 GPIO_ACTIVE_LOW>, // Pin for column 2
<&gpio0 15 GPIO_ACTIVE_LOW>, // Pin for column 3
<&gpio0 14 GPIO_ACTIVE_LOW>, // Pin for column 4
<&gpio0 16 GPIO_ACTIVE_LOW>, // Pin for column 5
<&gpio0 10 GPIO_ACTIVE_LOW>; // Pin for column 6
// The map property defines the row/column positions for the key matrix
map = <0 1>, <0 2>, <0 3>, <0 4>, <0 5>, // Row 0
<1 1>, <1 2>, <1 3>, <1 4>, <1 5>, // Row 1
<2 1>, <2 2>, <2 3>, <2 4>, <2 5>, // Row 2
<3 0>, <3 1>, <3 2>; // Row 3 aka thumb cluster
};
behaviors {
ht: hold_tap {
compatible = "zmk,behavior-hold-tap";
#binding-cells = <2>;
flavor = "tap-preferred";
tapping-term-ms = <220>;
quick-tap-ms = <150>;
require-prior-idle-ms = <100>;
bindings = <&kp>, <&kp>;
};
};
conditional_layers {
compatible = "zmk,conditional-layers";
tri_layer {
if-layers = <1 2>;
then-layer = <3>;
};
};
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
//╭──────────┬──────────┬──────────┬──────────┬──────────╮ ╭──────────┬──────────┬──────────┬──────────┬──────────╮
//│ Q │ W │ E │ R │ T │ │ Y │ U │ I │ O │ P │
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
//├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
//│ A │ S │ D │ F │ G │ │ H │ J │ K │ L │ ' " │
HRML(A, S, D, F) &kp G &kp H HRMR(J, K, L, SQT)
//├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
//│ Z │ X │ C │ V │ B │ │ N │ M │ , < │ . > │ / ? │
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH
//╰──────────┴──────────┴──────────┼──────────┼──────────┼──────────╮ ╭──────────┼──────────┼──────────┴──────────┴──────────┴──────────╯
&lt 2 TAB &kp ENTER &kp ENTER &kp SPACE &kp SPACE &lt 1 BSPC
// ╰──────────┴──────────┴──────────╯ ╰──────────┴──────────┴──────────╯
>;
};
right_layer {
bindings = <
//╭──────────┬──────────┬──────────┬──────────┬──────────╮ ╭──────────┬──────────┬──────────┬──────────┬──────────╮
//│ INSERT │ 1 │ 2 │ 3 │ │ │ HOME │ PAGE DN │ PAGE UP │ END │ : │
&kp INS &kp N1 &kp N2 &kp N3 &trans &kp HOME &kp PG_DN &kp PG_UP &kp END &kp COLON
//├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
//│ DELETE │ 4 │ 5 │ 6 │ │ │ LEFT │ DOWN │ UP │ RIGHT │ ; │
&kp DEL &kp N4 &kp N5 &kp N6 &trans &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp SEMI
//├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
//│ CAPS │ 7 │ 8 │ 9 │ 0 │ │ │ │ │ │ │
&caps_word &kp N7 &kp N8 &kp N9 &kp N0 &trans &trans &trans &trans &trans
//╰──────────┴──────────┴──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┴──────────┴──────────╯
&trans &kp ESC &trans &trans
// ╰──────────┴──────────╯ ╰──────────┴──────────╯
>;
};
left_layer {
bindings = <
//╭──────────┬──────────┬──────────┬──────────┬──────────╮ ╭──────────┬──────────┬──────────┬──────────┬──────────╮
//│ │ [ │ { │ } │ │ │ ^ │ ( │ ) │ ] │ ~ │
&trans &kp LBKT &kp LBRC &kp RBRC &trans &kp CARET &kp LPAR &kp RPAR &kp RBKT &kp TILDE
//├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
//│ ! │ @ │ # │ $ │ % │ │ * │ - │ = │ \ │ ` │
&kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp ASTRK &kp MINUS &kp EQUAL &kp BSLH &kp GRAVE
//├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
//│ │ │ │ │ │ │ & │ _ │ + │ │ │ │
&trans &trans &trans &trans &trans &kp AMPS &kp UNDER &kp PLUS &kp PIPE &trans
//╰──────────┴──────────┴──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┴──────────┴──────────╯
&trans &trans &trans &trans
// ╰──────────┴──────────╯ ╰──────────┴──────────╯
>;
};
tri_layer {
bindings = <
//╭──────────┬──────────┬──────────┬──────────┬──────────╮ ╭──────────┬──────────┬──────────┬──────────┬──────────╮
//│ RESET │ │ │ │PROFILE 0 │ │ │ │ │ │ RESET │
&sys_reset &trans &trans &trans &bt BT_SEL 0 &trans &trans &trans &trans &sys_reset
//├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
//│BOOTLOADER│ │ │ │PROFILE 1 │ │ │ │ │ │BOOTLOADER│
&bootloader &trans &trans &trans &bt BT_SEL 1 &trans &trans &trans &trans &bootloader
//├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
//│ │ │ │ CLEAR BT │PROFILE 2 │ │ │ │ │ │ │
&trans &trans &trans &bt BT_CLR &bt BT_SEL 2 &trans &trans &trans &trans &trans
//╰──────────┴──────────┴──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┴──────────┴──────────╯
&trans &trans &trans &trans
// ╰──────────┴──────────╯ ╰──────────┴──────────╯
>;
};
};
};