refactor(shields): Set ZMK Uno physical layouts.

* Add physical layout definitions for uno and split uno shields.
This commit is contained in:
Peter Johanson 2024-05-01 14:07:48 -07:00 committed by Pete Johanson
parent 74f7fe921b
commit 5fcf092901
6 changed files with 82 additions and 20 deletions

View file

@ -40,10 +40,8 @@ nice_view_spi: &arduino_spi {
/ { / {
chosen { chosen {
zmk,kscan = &kscan_matrix;
zmk,backlight = &backlight; zmk,backlight = &backlight;
zmk,underglow = &led_strip; zmk,underglow = &led_strip;
zmk,matrix-transform = &matrix_transform;
}; };
// Commented out until we add more powerful power domain support // Commented out until we add more powerful power domain support
@ -109,7 +107,6 @@ nice_view_spi: &arduino_spi {
kscan_direct: kscan_direct { kscan_direct: kscan_direct {
compatible = "zmk,kscan-gpio-direct"; compatible = "zmk,kscan-gpio-direct";
wakeup-source; wakeup-source;
status = "disabled";
input-gpios input-gpios
= <&arduino_header 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> = <&arduino_header 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>

View file

@ -13,13 +13,9 @@
// Uncomment the following lines if using the "Direct Wire" jumper to switch the matrix to a direct wire. // Uncomment the following lines if using the "Direct Wire" jumper to switch the matrix to a direct wire.
// &kscan_direct { status = "okay"; };
// &kscan_matrix { status = "disabled"; };
// / { // / {
// chosen { // chosen {
// zmk,matrix-transform = &direct_matrix_transform; // zmk,physical-layout = &direct_physical_layout;
// zmk,kscan = &kscan_direct;
// }; // };
// }; // };

View file

@ -7,13 +7,15 @@
#include "zmk_uno.dtsi" #include "zmk_uno.dtsi"
#include <behaviors.dtsi> #include <behaviors.dtsi>
#include <physical_layouts.dtsi>
#include <dt-bindings/zmk/bt.h> #include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h> #include <dt-bindings/zmk/outputs.h>
/ { / {
chosen { chosen {
zmk,matrix-transform = &matrix_transform; zmk,physical-layout = &matrix_physical_layout;
}; };
sensors: sensors { sensors: sensors {
compatible = "zmk,keymap-sensors"; compatible = "zmk,keymap-sensors";
sensors = <&encoder>; sensors = <&encoder>;
@ -58,4 +60,35 @@
}; };
}; };
matrix_physical_layout: matrix_physical_layout {
compatible = "zmk,physical-layout";
display-name = "Matrix Layout";
kscan = <&kscan_matrix>;
transform = <&matrix_transform>;
keys
= <&key_physical_attrs 100 100 0 0 0 0 0>
, <&key_physical_attrs 100 100 100 0 0 0 0>
, <&key_physical_attrs 100 100 0 100 0 0 0>
, <&key_physical_attrs 100 100 100 100 0 0 0>
;
};
direct_physical_layout: direct_physical_layout {
compatible = "zmk,physical-layout";
display-name = "Direct Wire Layout";
kscan = <&kscan_direct>;
transform = <&direct_matrix_transform>;
keys
= <&key_physical_attrs 100 100 0 0 0 0 0>
, <&key_physical_attrs 100 100 100 0 0 0 0>
, <&key_physical_attrs 100 100 0 100 0 0 0>
, <&key_physical_attrs 100 100 100 100 0 0 0>
;
};
}; };

View file

@ -6,13 +6,15 @@
#include "zmk_uno.dtsi" #include "zmk_uno.dtsi"
#include <physical_layouts.dtsi>
left_encoder: &encoder { left_encoder: &encoder {
status = "disabled"; status = "disabled";
}; };
/ { / {
chosen { chosen {
zmk,matrix-transform = &split_matrix_transform; zmk,physical-layout = &matrix_physical_layout;
}; };
split_matrix_transform: split_matrix_transform { split_matrix_transform: split_matrix_transform {
@ -31,18 +33,57 @@
split_direct_matrix_transform: split_direct_matrix_transform { split_direct_matrix_transform: split_direct_matrix_transform {
compatible = "zmk,matrix-transform"; compatible = "zmk,matrix-transform";
rows = <3>; rows = <2>;
columns = <4>; columns = <4>;
map = < map = <
RC(0,0) RC(0,1) RC(0,0) RC(0,1)
RC(0,2) RC(0,3) RC(0,2) RC(0,3)
RC(2,0) RC(2,1) RC(1,0) RC(1,1)
RC(2,2) RC(2,3) RC(1,2) RC(1,3)
>; >;
}; };
matrix_physical_layout: matrix_physical_layout {
compatible = "zmk,physical-layout";
display-name = "Matrix Layout";
kscan = <&kscan_matrix>;
transform = <&split_matrix_transform>;
keys
= <&key_physical_attrs 100 100 0 0 0 0 0>
, <&key_physical_attrs 100 100 100 0 0 0 0>
, <&key_physical_attrs 100 100 0 100 0 0 0>
, <&key_physical_attrs 100 100 100 100 0 0 0>
, <&key_physical_attrs 100 100 0 200 0 0 0>
, <&key_physical_attrs 100 100 100 200 0 0 0>
, <&key_physical_attrs 100 100 0 300 0 0 0>
, <&key_physical_attrs 100 100 100 300 0 0 0>
;
};
direct_physical_layout: direct_physical_layout {
compatible = "zmk,physical-layout";
display-name = "Direct Wire Layout";
kscan = <&kscan_direct>;
transform = <&split_direct_matrix_transform>;
keys
= <&key_physical_attrs 100 100 0 0 0 0 0>
, <&key_physical_attrs 100 100 100 0 0 0 0>
, <&key_physical_attrs 100 100 0 100 0 0 0>
, <&key_physical_attrs 100 100 100 100 0 0 0>
, <&key_physical_attrs 100 100 0 200 0 0 0>
, <&key_physical_attrs 100 100 100 200 0 0 0>
, <&key_physical_attrs 100 100 0 300 0 0 0>
, <&key_physical_attrs 100 100 100 300 0 0 0>
;
};
right_encoder: right_encoder { right_encoder: right_encoder {
steps = <80>; steps = <80>;
status = "disabled"; status = "disabled";

View file

@ -14,14 +14,9 @@
// Uncomment the following lines if using the "Direct Wire" jumper to switch the matrix to a direct wire. // Uncomment the following lines if using the "Direct Wire" jumper to switch the matrix to a direct wire.
// &kscan_direct { status = "okay"; };
// &kscan_matrix { status = "disabled"; };
// / { // / {
// chosen { // chosen {
// zmk,matrix-transform = &split_direct_matrix_transform; // zmk,physical-layout = &direct_physical_layout;
// zmk,kscan = &kscan_direct;
// }; // };
// }; // };

View file

@ -11,7 +11,7 @@
}; };
&split_direct_matrix_transform { &split_direct_matrix_transform {
row-offset = <2>; row-offset = <1>;
}; };
&right_encoder { &right_encoder {