Skip to content

Commit

Permalink
refactor(boards): Move ZMK Uno 1P3T slider to sideband
Browse files Browse the repository at this point in the history
* Invoke output selection from the slider on the ZMK Uno via
  sideband behavior setup, to simplify keymap.
  • Loading branch information
petejohanson committed Dec 31, 2023
1 parent b2cea50 commit 85f0d23
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 79 deletions.
36 changes: 1 addition & 35 deletions app/boards/shields/zmk_uno/zmk_uno.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ nice_view_spi: &arduino_spi {

/ {
chosen {
zmk,kscan = &kscan_matrix_comp;
zmk,kscan = &kscan_matrix;
zmk,backlight = &backlight;
zmk,underglow = &led_strip;
zmk,matrix-transform = &matrix_transform;
Expand Down Expand Up @@ -74,7 +74,6 @@ nice_view_spi: &arduino_spi {
map = <
RC(0,0) RC(0,1)
RC(1,0) RC(1,1)
RC(2,0) RC(2,1) RC(2,2)
>;
};

Expand All @@ -86,42 +85,9 @@ nice_view_spi: &arduino_spi {
map = <
RC(0,0) RC(0,1)
RC(0,2) RC(0,3)
RC(1,0) RC(1,1) RC(1,2)
>;
};


kscan_matrix_comp: kscan_matrix_comp {
compatible = "zmk,kscan-composite";
rows = <1>;
columns = <7>;

matrix {
kscan = <&kscan_matrix>;
};

toggle {
kscan = <&kscan_sp3t_toggle>;
row-offset = <2>;
};

};

kscan_direct_comp: kscan_direct_comp {
compatible = "zmk,kscan-composite";
status = "disabled";

matrix {
kscan = <&kscan_direct>;
};

toggle {
kscan = <&kscan_sp3t_toggle>;
row-offset = <1>;
};

};

kscan_matrix: kscan_matrix {
compatible = "zmk,kscan-gpio-matrix";
wakeup-source;
Expand Down
21 changes: 1 addition & 20 deletions app/boards/shields/zmk_uno/zmk_uno.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,32 @@
#include <dt-bindings/zmk/backlight.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/ext_power.h>
#include <dt-bindings/zmk/outputs.h>
#include <dt-bindings/zmk/rgb.h>

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

/* :REMOVE ME

&kscan_direct_comp { status = "okay"; };
&kscan_direct { status = "okay"; };
&kscan_matrix_comp { status = "disabled"; };
&kscan_matrix { status = "disabled"; };

/ {
chosen {
zmk,matrix-transform = &direct_matrix_transform;
zmk,kscan = &kscan_direct_comp;
zmk,kscan = &kscan_direct;
};
};

REMOVE ME: */


/ {
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>;
)
};

keymap {
compatible = "zmk,keymap";

default_layer {
bindings = <
&kp A &bl BL_TOG
&rgb_ug RGB_EFF &bt BT_CLR

&out OUT_USB &ble_zero &ble_one
>;

sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
Expand Down
40 changes: 40 additions & 0 deletions app/boards/shields/zmk_uno/zmk_uno.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include "zmk_uno.dtsi"

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

/ {
chosen {
zmk,matrix-transform = &matrix_transform;
Expand All @@ -19,4 +23,40 @@
};
};

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";
kscan = <&kscan_sp3t_toggle>;

usb {
row = <0>;
column = <0>;
bindings = <&out OUT_USB>;
};

ble_zero {
row = <0>;
column = <1>;
bindings = <&ble_zero>;
};

ble_one {
row = <0>;
column = <2>;
bindings = <&ble_one>;
};
};

};
10 changes: 4 additions & 6 deletions app/boards/shields/zmk_uno/zmk_uno_split.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@

split_matrix_transform: split_matrix_transform {
compatible = "zmk,matrix-transform";
rows = <3>;
columns = <4>;
rows = <4>;
columns = <2>;

map = <
RC(0,0) RC(0,1)
RC(1,0) RC(1,1)
RC(2,0) RC(2,1) RC(2,2)

RC(3,0) RC(3,1)
RC(4,0) RC(4,1)
RC(5,0) RC(5,1) RC(5,2)
>;
};

Expand All @@ -38,10 +37,9 @@
map = <
RC(0,0) RC(0,1)
RC(0,2) RC(0,3)
RC(1,0) RC(1,1) RC(1,2)

RC(2,0) RC(2,1)
RC(2,2) RC(2,3)
RC(3,0) RC(3,1) RC(3,2)
>;
};

Expand Down
18 changes: 0 additions & 18 deletions app/boards/shields/zmk_uno/zmk_uno_split.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

/* :REMOVE ME

&kscan_direct_comp { status = "okay"; };
&kscan_direct { status = "okay"; };
&kscan_matrix_comp { status = "disabled"; };
&kscan_matrix { status = "disabled"; };

/ {
Expand All @@ -30,20 +28,7 @@

REMOVE ME: */


/ {
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>;
)
};

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

&out OUT_USB &ble_zero &ble_one

&kp C &kp D
&kp E &kp F
&none &none &none
>;

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

0 comments on commit 85f0d23

Please sign in to comment.