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.
This commit is contained in:
Peter Johanson 2023-12-31 00:57:00 +00:00 committed by Pete Johanson
parent a0ad1d4c94
commit c3144055e8
5 changed files with 46 additions and 79 deletions

View File

@ -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;
@ -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)
>;
};
@ -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;

View File

@ -9,42 +9,25 @@
#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";
@ -52,8 +35,6 @@ REMOVE ME: */
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>;

View File

@ -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;
@ -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>;
};
};
};

View File

@ -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)
>;
};
@ -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)
>;
};

View File

@ -16,9 +16,7 @@
/* :REMOVE ME
&kscan_direct_comp { status = "okay"; };
&kscan_direct { status = "okay"; };
&kscan_matrix_comp { status = "disabled"; };
&kscan_matrix { status = "disabled"; };
/ {
@ -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";
@ -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>;