mirror of
https://github.com/averymd/sofle-v2-oled-zmk.git
synced 2026-01-09 16:21:59 +00:00
160 lines
18 KiB
Plaintext
160 lines
18 KiB
Plaintext
/*
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <behaviors.dtsi>
|
|
#include <dt-bindings/zmk/bt.h>
|
|
#include <dt-bindings/zmk/ext_power.h>
|
|
#include <dt-bindings/zmk/keys.h>
|
|
#include <dt-bindings/zmk/rgb.h>
|
|
#include <zmk-helpers/helper.h>
|
|
#include <zmk-helpers/key-labels/sofle.h>
|
|
|
|
#define BASE 0
|
|
#define LOWER 1
|
|
#define RAISE 2
|
|
#define ADJUST 3
|
|
|
|
#define KEYS_L LN0 LN1 LN2 LN3 LN4 LN5 LT0 LT1 LT2 LT3 LT4 LT5 LM0 LM1 LM2 LM3 LM4 LM5 LB0 LB1 LB2 LB3 LB4 LB5 // Left-hand keys.
|
|
#define KEYS_R RN0 RN1 RN2 RN3 RN4 RN5 RT0 RT1 RT2 RT3 RT4 RT5 RM0 RM1 RM2 RM3 RM4 RM5 RB0 RB1 RB2 RB3 RB4 RB5 // Right-hand keys.
|
|
#define THUMBS LH4 LH3 LH2 LH1 LH0 RH0 RH1 RH2 RH3 RH4 // Thumb keys.
|
|
|
|
/ {
|
|
// Activate ADJUST layer by pressing raise and lower
|
|
|
|
conditional_layers {
|
|
compatible = "zmk,conditional-layers";
|
|
|
|
adjust_layer {
|
|
if-layers = <LOWER RAISE>;
|
|
then-layer = <ADJUST>;
|
|
};
|
|
};
|
|
|
|
behaviors {
|
|
mt: mod_tap {
|
|
compatible = "zmk,behavior-hold-tap";
|
|
#binding-cells = <2>;
|
|
flavor = "tap-preferred";
|
|
tapping-term-ms = <300>;
|
|
bindings = <&kp>, <&kp>;
|
|
display-name = "Mod-Tap";
|
|
};
|
|
hml: home_row_mod_left {
|
|
compatible = "zmk,behavior-hold-tap";
|
|
#binding-cells = <2>;
|
|
flavor = "balanced";
|
|
require-prior-idle-ms = <150>;
|
|
tapping-term-ms = <280>;
|
|
quick-tap-ms = <175>;
|
|
bindings = <&kp>, <&kp>;
|
|
hold-trigger-key-positions = <KEYS_R THUMBS>; // List of keys on the right side of the keyboard
|
|
hold-trigger-on-release;
|
|
};
|
|
hmr: home_row_mod_right {
|
|
compatible = "zmk,behavior-hold-tap";
|
|
#binding-cells = <2>;
|
|
flavor = "balanced";
|
|
require-prior-idle-ms = <150>;
|
|
tapping-term-ms = <280>;
|
|
quick-tap-ms = <175>;
|
|
bindings = <&kp>, <&kp>;
|
|
hold-trigger-key-positions = <KEYS_L THUMBS>; // List of keys on the left side of the keyboard
|
|
hold-trigger-on-release;
|
|
};
|
|
};
|
|
|
|
keymap {
|
|
compatible = "zmk,keymap";
|
|
|
|
default_layer {
|
|
label = "default";
|
|
|
|
bindings = <
|
|
//╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
|
|
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&kp EQUAL &kp Q &kp W &kp E &kp R &mt LBRC T &mt RBRC Y &kp U &kp I &kp O &kp P &kp BSLH
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&kp BSPC &hml LGUI A &hml LALT S &hml LSHIFT D &hml LCTRL F &mt HOME G &mt END H &hmr RCTRL J &hmr RSHIFT K &hmr RALT L &hmr LGUI SEMI &kp SQT
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&mt LBRC RBRC &kp Z &kp X &kp C &kp V &mt LBKT B &kp LGUI &kp LG(LS(S)) &mt RBKT N &kp M &kp COMMA &kp DOT &kp FSLH &mt LBKT RBKT
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&mt LBKT RBKT &kp LC(F12) &kp LALT &mo LOWER &kp SPACE &kp RET &mo RAISE &kp TAB &kp DEL &kp ESC
|
|
// ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯
|
|
>;
|
|
|
|
sensor-bindings =
|
|
<&inc_dec_kp LEFT RIGHT>,
|
|
<&inc_dec_kp DOWN UP>;
|
|
};
|
|
|
|
lower_layer {
|
|
label = "lower";
|
|
|
|
bindings = <
|
|
//╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
|
|
&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp F12
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR &kp PIPE
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp EQUAL &kp MINUS &kp KP_PLUS &kp LBRC &kp RBRC &trans &trans &kp LBKT &kp RBKT &kp SEMI &kp COLON &kp BSLH &trans
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
|
// ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯
|
|
>;
|
|
|
|
// TODO: Some binds are waiting for shifted keycode support.
|
|
|
|
sensor-bindings =
|
|
<&inc_dec_kp LEFT RIGHT>,
|
|
<&inc_dec_kp DOWN UP>;
|
|
};
|
|
|
|
raise_layer {
|
|
label = "raise";
|
|
|
|
bindings = <
|
|
//╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
|
|
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &trans &trans &trans &trans &trans &trans
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp INS &kp PSCRN &kp K_CMENU &trans &trans &kp PG_UP &trans &kp UP &trans &kp N0 &trans
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp LALT &kp LCTRL &kp LSHFT &trans &kp CLCK &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp DEL &kp BSPC
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp K_UNDO &kp K_CUT &kp K_COPY &kp K_PASTE &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
|
// ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯
|
|
>;
|
|
|
|
|
|
sensor-bindings =
|
|
<&inc_dec_kp LEFT RIGHT>,
|
|
<&inc_dec_kp DOWN UP>;
|
|
};
|
|
|
|
adjust_layer {
|
|
// ----------------------------------------------------------------------------------------------------------------------------
|
|
// | BTCLR | BT1 | BT2 | BT3 | BT4 | BT5 | | | | | | | |
|
|
// | EXTPWR | RGB_HUD | RGB_HUI | RGB_SAD | RGB_SAI | RGB_EFF | | | | | | | |
|
|
// | | RGB_BRD | RGB_BRI | | | | | | | | | | |
|
|
// | | | | | | | RGB_TOG | | | | | | | | |
|
|
// | | | | | | | | | | | |
|
|
|
|
label = "adjust";
|
|
bindings = <
|
|
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &none &none &none &none &none
|
|
&ext_power EP_TOG &rgb_ug RGB_HUD &rgb_ug RGB_HUI &rgb_ug RGB_SAD &rgb_ug RGB_SAI &rgb_ug RGB_EFF &none &none &none &none &none &none
|
|
&none &rgb_ug RGB_BRD &rgb_ug RGB_BRI &none &none &none &none &none &none &none &none &none
|
|
&none &none &none &none &none &none &rgb_ug RGB_TOG &none &none &none &none &none &none &none
|
|
&none &none &none &none &none &none &none &none &none &none
|
|
>;
|
|
};
|
|
};
|
|
};
|