zmk-config/config/corne.keymap
afiqzudinhadi f1ba3dec58 Fix per-key RGB: correct pixel-lookup, chain-length, effect config
- pixel-lookup: column-by-column snake per foostan Corne v1.1 PCB diagram
- chain-length=27 in keymap (fork shield overlay overrides to 10)
- EFF_START=4 (layer indicators), ON_START=y, AUTO_OFF_IDLE=n
- Document per-key RGB in README with LED chain order and usage
2026-06-26 00:11:45 +08:00

230 lines
10 KiB
C++

/*
* Copyright (c) 2020 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>
#include <dt-bindings/zmk/ext_power.h>
#include <dt-bindings/led/led.h>
#include <dt-bindings/zmk/backlight.h>
#include <dt-bindings/zmk/rgb.h>
#include <dt-bindings/zmk/reset.h>
#include <dt-bindings/zmk/rgb_colors.h>
&led_strip {
chain-length = <27>;
};
/ {
behaviors {
ht_mute_pp: ht_mute_pp {
compatible = "zmk,behavior-hold-tap";
#binding-cells = <2>;
tapping-term-ms = <200>;
bindings = <&kp>, <&kp>;
};
td_rgb: td_rgb {
compatible = "zmk,behavior-tap-dance";
#binding-cells = <0>;
tapping-term-ms = <300>;
bindings = <&rgb_ug RGB_TOG>, <&rgb_ug RGB_EFF>, <&rgb_ug RGB_EFR>;
};
td_colors: td_colors {
compatible = "zmk,behavior-tap-dance";
#binding-cells = <0>;
tapping-term-ms = <400>;
bindings = <&rgb_ug RGB_COLOR_HSB(270,89,90)>,
<&rgb_ug RGB_COLOR_HSB(0,0,100)>,
<&rgb_ug RGB_COLOR_HSB(0,100,100)>,
<&rgb_ug RGB_COLOR_HSB(240,100,100)>,
<&rgb_ug RGB_COLOR_HSB(120,100,100)>;
};
};
combos {
compatible = "zmk,combos";
// Top + home row combos = numbers (like ecosteno)
combo_1 { key-positions = <1 13>; bindings = <&kp N1>; layers = <0 1>; };
combo_2 { key-positions = <2 14>; bindings = <&kp N2>; layers = <0 1>; };
combo_3 { key-positions = <3 15>; bindings = <&kp N3>; layers = <0 1>; };
combo_4 { key-positions = <4 16>; bindings = <&kp N4>; layers = <0 1>; };
combo_5 { key-positions = <5 17>; bindings = <&kp N5>; layers = <0 1>; };
combo_6 { key-positions = <6 18>; bindings = <&kp N6>; layers = <0 1>; };
combo_7 { key-positions = <7 19>; bindings = <&kp N7>; layers = <0 1>; };
combo_8 { key-positions = <8 20>; bindings = <&kp N8>; layers = <0 1>; };
combo_9 { key-positions = <9 21>; bindings = <&kp N9>; layers = <0 1>; };
combo_0 { key-positions = <10 22>; bindings = <&kp N0>; layers = <0 1>; };
// I+O (QWRT) / U+B (CARP) = BSPC
combo_bspc { key-positions = <8 9>; bindings = <&kp BSPC>; layers = <0 1>; };
// K+L (QWRT) / E+O (CARP) = ENTER
combo_enter { key-positions = <20 21>; bindings = <&kp RET>; layers = <0 1>; };
// W+E (QWRT) / G+M (CARP) = ESC
combo_esc { key-positions = <2 3>; bindings = <&kp ESC>; layers = <0 1>; };
// S+D (QWRT) / S+T (CARP) = TAB
combo_tab { key-positions = <14 15>; bindings = <&kp TAB>; layers = <0 1>; };
};
/*
* Per-key RGB layer colors (darknao fork).
*
* pixel-lookup maps LED chain index → key position.
* Current mapping assumes left-half serpentine wiring:
* underglow(6) → row0(L→R) → row1(R→L) → row2(L→R) → thumbs(R→L)
* Right half will mirror left colors until per-half overlays are added.
* Adjust pixel-lookup if LEDs map to wrong keys on your PCB.
*
* Key positions:
* 0 1 2 3 4 5 | 6 7 8 9 10 11
* 12 13 14 15 16 17 | 18 19 20 21 22 23
* 24 25 26 27 28 29 | 30 31 32 33 34 35
* 36 37 38 | 39 40 41
*/
underglow-layer {
compatible = "zmk,underglow-layer";
/* Foostan Corne v1.1 LED chain (left half):
* Column-by-column snake with interleaved thumbs.
* chain 0-5: underglow (skip)
* chain 6-8: thumb0 → bottom/home/top col0
* chain 9-12: top/home/bottom col1 → thumb1 → thumb2
* chain 13-17: bottom/home/top col2 → top/home/bottom col3
* chain 18-22: bottom/home/top col4 → top/home/bottom col5
*/
pixel-lookup = <
255 255 255 255 255 255
36 24 12 0 1 13
25 37 38 26 14 2
3 15 27 28 16 4
5 17 29
>;
carp_rgb {
layer-id = <0>;
bindings = <
&ug WHITE &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL
&ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug WHITE
&ug WHITE &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL
&ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug WHITE
&ug WHITE &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL
&ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug TEAL &ug WHITE
&ug PURPLE &ug WHITE &ug WHITE
&ug WHITE &ug WHITE &ug PURPLE
>;
};
qwrt_rgb {
layer-id = <1>;
bindings = <
&ug WHITE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE
&ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug WHITE
&ug WHITE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE
&ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug WHITE
&ug WHITE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE
&ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug WHITE
&ug PURPLE &ug WHITE &ug WHITE
&ug WHITE &ug WHITE &ug PURPLE
>;
};
sten_rgb {
layer-id = <2>;
bindings = <
&ug ___ &ug RED &ug RED &ug RED &ug RED &ug RED
&ug RED &ug RED &ug RED &ug RED &ug RED &ug WHITE
&ug WHITE &ug RED &ug RED &ug RED &ug RED &ug RED
&ug RED &ug RED &ug RED &ug RED &ug RED &ug RED
&ug ___ &ug RED &ug RED &ug RED &ug RED &ug RED
&ug RED &ug RED &ug RED &ug RED &ug RED &ug RED
&ug ___ &ug RED &ug RED
&ug RED &ug RED &ug ___
>;
};
fps_rgb {
layer-id = <3>;
bindings = <
&ug ORANGE &ug ORANGE &ug BLUE &ug GREEN &ug BLUE &ug BLUE
&ug ___ &ug ___ &ug ___ &ug ___ &ug ___ &ug WHITE
&ug BLUE &ug ORANGE &ug GREEN &ug GREEN &ug GREEN &ug BLUE
&ug ___ &ug ___ &ug ___ &ug ___ &ug ___ &ug ___
&ug ORANGE &ug BLUE &ug BLUE &ug BLUE &ug BLUE &ug BLUE
&ug ___ &ug ___ &ug ___ &ug ___ &ug ___ &ug ___
&ug BLUE &ug ORANGE &ug GREEN
&ug ___ &ug ___ &ug ___
>;
};
hub_rgb {
layer-id = <4>;
bindings = <
&ug RED &ug PURPLE &ug PURPLE &ug PURPLE &ug PURPLE &ug PURPLE
&ug BLUE &ug YELLOW &ug YELLOW &ug YELLOW &ug BLUE &ug BLUE
&ug ORANGE &ug ORANGE &ug ORANGE &ug ORANGE &ug TEAL &ug TEAL
&ug BLUE &ug YELLOW &ug YELLOW &ug YELLOW &ug BLUE &ug BLUE
&ug WHITE &ug ORANGE &ug ORANGE &ug ORANGE &ug TEAL &ug TEAL
&ug GREEN &ug GREEN &ug GREEN &ug GREEN &ug GOLD &ug WHITE
&ug PURPLE &ug WHITE &ug WHITE
&ug WHITE &ug WHITE &ug PURPLE
>;
fade-delay = <15>;
};
};
keymap {
compatible = "zmk,keymap";
carpalx_layer {
display-name = "CARP";
bindings = <
&kp GRAVE &kp Q &kp G &kp M &kp L &kp W &kp Y &kp F &kp U &kp B &kp SEMI &to 4
&mo 4 &kp D &kp S &kp T &kp N &kp R &kp I &kp A &kp E &kp O &kp H &kp SQT
&kp LSHFT &kp Z &kp X &kp C &kp V &kp J &kp K &kp P &kp COMMA &kp DOT &kp FSLH &kp RSHFT
&td_rgb &kp LCTRL &kp LGUI &kp SPACE &kp RALT &ht_mute_pp C_PLAY_PAUSE C_MUTE
>;
};
qwerty_layer {
display-name = "QWRT";
bindings = <
&kp GRAVE &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &to 4
&mo 4 &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT
&td_rgb &kp LCTRL &kp LGUI &kp SPACE &kp RALT &ht_mute_pp C_PLAY_PAUSE C_MUTE
>;
};
steno_layer {
display-name = "STEN";
bindings = <
&none &none &none &none &none &none &none &none &none &none &none &to 4
&mo 4 &none &none &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none
>;
};
fps_layer {
display-name = "FPS";
bindings = <
&mt ESC N1 &kp N2 &kp Q &kp W &mt N3 E &mt N4 R &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &to 4
&kp TAB &kp LSHFT &kp A &kp S &kp D &kp F &none &none &none &none &none &none
&mt LALT M &kp Z &kp X &kp C &kp V &kp G &none &none &none &none &none &none
&kp T &kp LCTRL &kp SPACE &none &none &none
>;
};
hub_layer {
display-name = "HUB";
bindings = <
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp PLUS &kp LBKT &kp UP &kp RBKT &kp ASTRK &kp EQUAL
&out OUT_TOG &rgb_ug RGB_HUI &rgb_ug RGB_SAI &rgb_ug RGB_BRI &kp C_BRI_UP &kp C_VOL_UP &kp MINUS &kp LEFT &kp DOWN &kp RIGHT &kp FSLH &kp BSLH
&kp LSHFT &rgb_ug RGB_HUD &rgb_ug RGB_SAD &rgb_ug RGB_BRD &kp C_BRI_DN &kp C_VOL_DN &to 0 &to 1 &to 2 &to 3 &td_colors &kp RSHFT
&td_rgb &kp LCTRL &kp LGUI &kp SPACE &kp RALT &ht_mute_pp C_PLAY_PAUSE C_MUTE
>;
};
};
};