Skip to content

Commit 85f0d23

Browse files
committed
refactor(boards): Move ZMK Uno 1P3T slider to sideband
* Invoke output selection from the slider on the ZMK Uno via sideband behavior setup, to simplify keymap.
1 parent b2cea50 commit 85f0d23

File tree

5 files changed

+46
-79
lines changed

5 files changed

+46
-79
lines changed

app/boards/shields/zmk_uno/zmk_uno.dtsi

+1-35
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ nice_view_spi: &arduino_spi {
4040

4141
/ {
4242
chosen {
43-
zmk,kscan = &kscan_matrix_comp;
43+
zmk,kscan = &kscan_matrix;
4444
zmk,backlight = &backlight;
4545
zmk,underglow = &led_strip;
4646
zmk,matrix-transform = &matrix_transform;
@@ -74,7 +74,6 @@ nice_view_spi: &arduino_spi {
7474
map = <
7575
RC(0,0) RC(0,1)
7676
RC(1,0) RC(1,1)
77-
RC(2,0) RC(2,1) RC(2,2)
7877
>;
7978
};
8079

@@ -86,42 +85,9 @@ nice_view_spi: &arduino_spi {
8685
map = <
8786
RC(0,0) RC(0,1)
8887
RC(0,2) RC(0,3)
89-
RC(1,0) RC(1,1) RC(1,2)
9088
>;
9189
};
9290

93-
94-
kscan_matrix_comp: kscan_matrix_comp {
95-
compatible = "zmk,kscan-composite";
96-
rows = <1>;
97-
columns = <7>;
98-
99-
matrix {
100-
kscan = <&kscan_matrix>;
101-
};
102-
103-
toggle {
104-
kscan = <&kscan_sp3t_toggle>;
105-
row-offset = <2>;
106-
};
107-
108-
};
109-
110-
kscan_direct_comp: kscan_direct_comp {
111-
compatible = "zmk,kscan-composite";
112-
status = "disabled";
113-
114-
matrix {
115-
kscan = <&kscan_direct>;
116-
};
117-
118-
toggle {
119-
kscan = <&kscan_sp3t_toggle>;
120-
row-offset = <1>;
121-
};
122-
123-
};
124-
12591
kscan_matrix: kscan_matrix {
12692
compatible = "zmk,kscan-gpio-matrix";
12793
wakeup-source;

app/boards/shields/zmk_uno/zmk_uno.keymap

+1-20
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,32 @@
99
#include <dt-bindings/zmk/backlight.h>
1010
#include <dt-bindings/zmk/bt.h>
1111
#include <dt-bindings/zmk/ext_power.h>
12-
#include <dt-bindings/zmk/outputs.h>
1312
#include <dt-bindings/zmk/rgb.h>
1413

1514
// Uncomment the following block if using the "Direct Wire" jumper to switch the matrix to a direct wire.
1615

1716
/* :REMOVE ME
1817

19-
&kscan_direct_comp { status = "okay"; };
2018
&kscan_direct { status = "okay"; };
21-
&kscan_matrix_comp { status = "disabled"; };
2219
&kscan_matrix { status = "disabled"; };
2320

2421
/ {
2522
chosen {
2623
zmk,matrix-transform = &direct_matrix_transform;
27-
zmk,kscan = &kscan_direct_comp;
24+
zmk,kscan = &kscan_direct;
2825
};
2926
};
3027

3128
REMOVE ME: */
3229

33-
3430
/ {
35-
macros {
36-
ZMK_MACRO(ble_zero,
37-
wait-ms = <1>;
38-
tap-ms = <1>;
39-
bindings = <&out OUT_BLE &bt BT_SEL 0>;
40-
)
41-
ZMK_MACRO(ble_one,
42-
wait-ms = <1>;
43-
tap-ms = <1>;
44-
bindings = <&out OUT_BLE &bt BT_SEL 1>;
45-
)
46-
};
47-
4831
keymap {
4932
compatible = "zmk,keymap";
5033

5134
default_layer {
5235
bindings = <
5336
&kp A &bl BL_TOG
5437
&rgb_ug RGB_EFF &bt BT_CLR
55-
56-
&out OUT_USB &ble_zero &ble_one
5738
>;
5839

5940
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;

app/boards/shields/zmk_uno/zmk_uno.overlay

+40
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
#include "zmk_uno.dtsi"
88

9+
#include <behaviors.dtsi>
10+
#include <dt-bindings/zmk/bt.h>
11+
#include <dt-bindings/zmk/outputs.h>
12+
913
/ {
1014
chosen {
1115
zmk,matrix-transform = &matrix_transform;
@@ -19,4 +23,40 @@
1923
};
2024
};
2125

26+
macros {
27+
ZMK_MACRO(ble_zero,
28+
wait-ms = <1>;
29+
tap-ms = <1>;
30+
bindings = <&out OUT_BLE &bt BT_SEL 0>;
31+
)
32+
ZMK_MACRO(ble_one,
33+
wait-ms = <1>;
34+
tap-ms = <1>;
35+
bindings = <&out OUT_BLE &bt BT_SEL 1>;
36+
)
37+
};
38+
39+
endpoint_sideband_behaviors {
40+
compatible = "zmk,kscan-sideband-behaviors";
41+
kscan = <&kscan_sp3t_toggle>;
42+
43+
usb {
44+
row = <0>;
45+
column = <0>;
46+
bindings = <&out OUT_USB>;
47+
};
48+
49+
ble_zero {
50+
row = <0>;
51+
column = <1>;
52+
bindings = <&ble_zero>;
53+
};
54+
55+
ble_one {
56+
row = <0>;
57+
column = <2>;
58+
bindings = <&ble_one>;
59+
};
60+
};
61+
2262
};

app/boards/shields/zmk_uno/zmk_uno_split.dtsi

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@
1717

1818
split_matrix_transform: split_matrix_transform {
1919
compatible = "zmk,matrix-transform";
20-
rows = <3>;
21-
columns = <4>;
20+
rows = <4>;
21+
columns = <2>;
2222

2323
map = <
2424
RC(0,0) RC(0,1)
2525
RC(1,0) RC(1,1)
26-
RC(2,0) RC(2,1) RC(2,2)
26+
2727
RC(3,0) RC(3,1)
2828
RC(4,0) RC(4,1)
29-
RC(5,0) RC(5,1) RC(5,2)
3029
>;
3130
};
3231

@@ -38,10 +37,9 @@
3837
map = <
3938
RC(0,0) RC(0,1)
4039
RC(0,2) RC(0,3)
41-
RC(1,0) RC(1,1) RC(1,2)
40+
4241
RC(2,0) RC(2,1)
4342
RC(2,2) RC(2,3)
44-
RC(3,0) RC(3,1) RC(3,2)
4543
>;
4644
};
4745

app/boards/shields/zmk_uno/zmk_uno_split.keymap

-18
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
/* :REMOVE ME
1818

19-
&kscan_direct_comp { status = "okay"; };
2019
&kscan_direct { status = "okay"; };
21-
&kscan_matrix_comp { status = "disabled"; };
2220
&kscan_matrix { status = "disabled"; };
2321

2422
/ {
@@ -30,20 +28,7 @@
3028

3129
REMOVE ME: */
3230

33-
3431
/ {
35-
macros {
36-
ZMK_MACRO(ble_zero,
37-
wait-ms = <1>;
38-
tap-ms = <1>;
39-
bindings = <&out OUT_BLE &bt BT_SEL 0>;
40-
)
41-
ZMK_MACRO(ble_one,
42-
wait-ms = <1>;
43-
tap-ms = <1>;
44-
bindings = <&out OUT_BLE &bt BT_SEL 1>;
45-
)
46-
};
4732

4833
keymap {
4934
compatible = "zmk,keymap";
@@ -53,11 +38,8 @@ REMOVE ME: */
5338
&kp A &bl BL_TOG
5439
&rgb_ug RGB_EFF &bt BT_CLR
5540

56-
&out OUT_USB &ble_zero &ble_one
57-
5841
&kp C &kp D
5942
&kp E &kp F
60-
&none &none &none
6143
>;
6244

6345
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;

0 commit comments

Comments
 (0)