Skip to content

Commit

Permalink
refactor: new physical layouts convention
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Munnich committed Nov 5, 2024
1 parent ac141e0 commit 192931c
Show file tree
Hide file tree
Showing 30 changed files with 456 additions and 470 deletions.
87 changes: 87 additions & 0 deletions app/boards/arm/adv360pro/adv360pro-layouts.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#include <physical_layouts.dtsi>

/ {
physical_layout0: physical_layout_0 {
compatible = "zmk,physical-layout";
display-name = "Default";

keys // w h x y rot rx ry
= <&key_physical_attrs 125 100 0 25 0 0 0>
, <&key_physical_attrs 100 100 125 25 0 0 0>
, <&key_physical_attrs 100 100 225 0 0 0 0>
, <&key_physical_attrs 100 100 325 0 0 0 0>
, <&key_physical_attrs 100 100 425 0 0 0 0>
, <&key_physical_attrs 100 100 525 0 0 0 0>
, <&key_physical_attrs 100 100 625 0 0 0 0>
, <&key_physical_attrs 100 100 1075 0 0 0 0>
, <&key_physical_attrs 100 100 1175 0 0 0 0>
, <&key_physical_attrs 100 100 1275 0 0 0 0>
, <&key_physical_attrs 100 100 1375 0 0 0 0>
, <&key_physical_attrs 100 100 1475 0 0 0 0>
, <&key_physical_attrs 100 100 1575 25 0 0 0>
, <&key_physical_attrs 125 100 1675 25 0 0 0>
, <&key_physical_attrs 125 100 0 125 0 0 0>
, <&key_physical_attrs 100 100 125 125 0 0 0>
, <&key_physical_attrs 100 100 225 100 0 0 0>
, <&key_physical_attrs 100 100 325 100 0 0 0>
, <&key_physical_attrs 100 100 425 100 0 0 0>
, <&key_physical_attrs 100 100 525 100 0 0 0>
, <&key_physical_attrs 100 100 625 100 0 0 0>
, <&key_physical_attrs 100 100 1075 100 0 0 0>
, <&key_physical_attrs 100 100 1175 100 0 0 0>
, <&key_physical_attrs 100 100 1275 100 0 0 0>
, <&key_physical_attrs 100 100 1375 100 0 0 0>
, <&key_physical_attrs 100 100 1475 100 0 0 0>
, <&key_physical_attrs 100 100 1575 125 0 0 0>
, <&key_physical_attrs 125 100 1675 125 0 0 0>
, <&key_physical_attrs 125 100 0 225 0 0 0>
, <&key_physical_attrs 100 100 125 225 0 0 0>
, <&key_physical_attrs 100 100 225 200 0 0 0>
, <&key_physical_attrs 100 100 325 200 0 0 0>
, <&key_physical_attrs 100 100 425 200 0 0 0>
, <&key_physical_attrs 100 100 525 200 0 0 0>
, <&key_physical_attrs 100 100 625 200 0 0 0>
, <&key_physical_attrs 100 100 675 400 1500 525 400>
, <&key_physical_attrs 100 100 775 400 1500 525 400>
, <&key_physical_attrs 100 100 925 400 (-1500) 1275 400>
, <&key_physical_attrs 100 100 1025 400 (-1500) 1275 400>
, <&key_physical_attrs 100 100 1075 200 0 0 0>
, <&key_physical_attrs 100 100 1175 200 0 0 0>
, <&key_physical_attrs 100 100 1275 200 0 0 0>
, <&key_physical_attrs 100 100 1375 200 0 0 0>
, <&key_physical_attrs 100 100 1475 200 0 0 0>
, <&key_physical_attrs 100 100 1575 225 0 0 0>
, <&key_physical_attrs 125 100 1675 225 0 0 0>
, <&key_physical_attrs 125 100 0 325 0 0 0>
, <&key_physical_attrs 100 100 125 325 0 0 0>
, <&key_physical_attrs 100 100 225 300 0 0 0>
, <&key_physical_attrs 100 100 325 300 0 0 0>
, <&key_physical_attrs 100 100 425 300 0 0 0>
, <&key_physical_attrs 100 100 525 300 0 0 0>
, <&key_physical_attrs 100 100 775 500 1500 525 400>
, <&key_physical_attrs 100 100 925 500 (-1500) 1275 400>
, <&key_physical_attrs 100 100 1175 300 0 0 0>
, <&key_physical_attrs 100 100 1275 300 0 0 0>
, <&key_physical_attrs 100 100 1375 300 0 0 0>
, <&key_physical_attrs 100 100 1475 300 0 0 0>
, <&key_physical_attrs 100 100 1575 325 0 0 0>
, <&key_physical_attrs 125 100 1675 325 0 0 0>
, <&key_physical_attrs 125 100 0 425 0 0 0>
, <&key_physical_attrs 100 100 125 425 0 0 0>
, <&key_physical_attrs 100 100 225 400 0 0 0>
, <&key_physical_attrs 100 100 325 400 0 0 0>
, <&key_physical_attrs 100 100 425 400 0 0 0>
, <&key_physical_attrs 100 200 575 500 1500 525 400>
, <&key_physical_attrs 100 200 675 500 1500 525 400>
, <&key_physical_attrs 100 100 775 600 1500 525 400>
, <&key_physical_attrs 100 100 925 600 (-1500) 1275 400>
, <&key_physical_attrs 100 200 1025 500 (-1500) 1275 400>
, <&key_physical_attrs 100 200 1125 500 (-1500) 1275 400>
, <&key_physical_attrs 100 100 1275 400 0 0 0>
, <&key_physical_attrs 100 100 1375 400 0 0 0>
, <&key_physical_attrs 100 100 1475 400 0 0 0>
, <&key_physical_attrs 100 100 1575 425 0 0 0>
, <&key_physical_attrs 125 100 1675 425 0 0 0>
;
};
};
99 changes: 8 additions & 91 deletions app/boards/arm/adv360pro/adv360pro.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#include <dt-bindings/led/led.h>
#include <dt-bindings/zmk/matrix_transform.h>

#include <physical_layouts.dtsi>

#include "adv360pro-layouts.dtsi"
#include "adv360pro-pinctrl.dtsi"

&physical_layout0 {
transform = <&matrix_transform0>;
};

/ {
model = "Adv360 Pro";
compatible = "kinesis,adv360pro";
Expand All @@ -23,14 +26,14 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan0;
zmk,backlight = &backlight;
zmk,battery = &vbatt;
zmk,physical-layout = &default_layout;
zmk,physical-layout = &physical_layout0;
zmk,kscan = &kscan0;
zmk,underglow = &led_strip;
};

default_transform: keymap_transform_0 {
matrix_transform0: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <20>;
rows = <5>;
Expand All @@ -46,92 +49,6 @@
>;
};

default_layout: default_layout {
compatible = "zmk,physical-layout";
display-name = "Default";

transform = <&default_transform>;

keys // w h x y rot rx ry
= <&key_physical_attrs 125 100 0 25 0 0 0>
, <&key_physical_attrs 100 100 125 25 0 0 0>
, <&key_physical_attrs 100 100 225 0 0 0 0>
, <&key_physical_attrs 100 100 325 0 0 0 0>
, <&key_physical_attrs 100 100 425 0 0 0 0>
, <&key_physical_attrs 100 100 525 0 0 0 0>
, <&key_physical_attrs 100 100 625 0 0 0 0>
, <&key_physical_attrs 100 100 1075 0 0 0 0>
, <&key_physical_attrs 100 100 1175 0 0 0 0>
, <&key_physical_attrs 100 100 1275 0 0 0 0>
, <&key_physical_attrs 100 100 1375 0 0 0 0>
, <&key_physical_attrs 100 100 1475 0 0 0 0>
, <&key_physical_attrs 100 100 1575 25 0 0 0>
, <&key_physical_attrs 125 100 1675 25 0 0 0>
, <&key_physical_attrs 125 100 0 125 0 0 0>
, <&key_physical_attrs 100 100 125 125 0 0 0>
, <&key_physical_attrs 100 100 225 100 0 0 0>
, <&key_physical_attrs 100 100 325 100 0 0 0>
, <&key_physical_attrs 100 100 425 100 0 0 0>
, <&key_physical_attrs 100 100 525 100 0 0 0>
, <&key_physical_attrs 100 100 625 100 0 0 0>
, <&key_physical_attrs 100 100 1075 100 0 0 0>
, <&key_physical_attrs 100 100 1175 100 0 0 0>
, <&key_physical_attrs 100 100 1275 100 0 0 0>
, <&key_physical_attrs 100 100 1375 100 0 0 0>
, <&key_physical_attrs 100 100 1475 100 0 0 0>
, <&key_physical_attrs 100 100 1575 125 0 0 0>
, <&key_physical_attrs 125 100 1675 125 0 0 0>
, <&key_physical_attrs 125 100 0 225 0 0 0>
, <&key_physical_attrs 100 100 125 225 0 0 0>
, <&key_physical_attrs 100 100 225 200 0 0 0>
, <&key_physical_attrs 100 100 325 200 0 0 0>
, <&key_physical_attrs 100 100 425 200 0 0 0>
, <&key_physical_attrs 100 100 525 200 0 0 0>
, <&key_physical_attrs 100 100 625 200 0 0 0>
, <&key_physical_attrs 100 100 675 400 1500 525 400>
, <&key_physical_attrs 100 100 775 400 1500 525 400>
, <&key_physical_attrs 100 100 925 400 (-1500) 1275 400>
, <&key_physical_attrs 100 100 1025 400 (-1500) 1275 400>
, <&key_physical_attrs 100 100 1075 200 0 0 0>
, <&key_physical_attrs 100 100 1175 200 0 0 0>
, <&key_physical_attrs 100 100 1275 200 0 0 0>
, <&key_physical_attrs 100 100 1375 200 0 0 0>
, <&key_physical_attrs 100 100 1475 200 0 0 0>
, <&key_physical_attrs 100 100 1575 225 0 0 0>
, <&key_physical_attrs 125 100 1675 225 0 0 0>
, <&key_physical_attrs 125 100 0 325 0 0 0>
, <&key_physical_attrs 100 100 125 325 0 0 0>
, <&key_physical_attrs 100 100 225 300 0 0 0>
, <&key_physical_attrs 100 100 325 300 0 0 0>
, <&key_physical_attrs 100 100 425 300 0 0 0>
, <&key_physical_attrs 100 100 525 300 0 0 0>
, <&key_physical_attrs 100 100 775 500 1500 525 400>
, <&key_physical_attrs 100 100 925 500 (-1500) 1275 400>
, <&key_physical_attrs 100 100 1175 300 0 0 0>
, <&key_physical_attrs 100 100 1275 300 0 0 0>
, <&key_physical_attrs 100 100 1375 300 0 0 0>
, <&key_physical_attrs 100 100 1475 300 0 0 0>
, <&key_physical_attrs 100 100 1575 325 0 0 0>
, <&key_physical_attrs 125 100 1675 325 0 0 0>
, <&key_physical_attrs 125 100 0 425 0 0 0>
, <&key_physical_attrs 100 100 125 425 0 0 0>
, <&key_physical_attrs 100 100 225 400 0 0 0>
, <&key_physical_attrs 100 100 325 400 0 0 0>
, <&key_physical_attrs 100 100 425 400 0 0 0>
, <&key_physical_attrs 100 200 575 500 1500 525 400>
, <&key_physical_attrs 100 200 675 500 1500 525 400>
, <&key_physical_attrs 100 100 775 600 1500 525 400>
, <&key_physical_attrs 100 100 925 600 (-1500) 1275 400>
, <&key_physical_attrs 100 200 1025 500 (-1500) 1275 400>
, <&key_physical_attrs 100 200 1125 500 (-1500) 1275 400>
, <&key_physical_attrs 100 100 1275 400 0 0 0>
, <&key_physical_attrs 100 100 1375 400 0 0 0>
, <&key_physical_attrs 100 100 1475 400 0 0 0>
, <&key_physical_attrs 100 100 1575 425 0 0 0>
, <&key_physical_attrs 125 100 1675 425 0 0 0>
;
};

// Node name must match original "EXT_POWER" label to preserve user settings.
EXT_POWER {
compatible = "zmk,ext-power-generic";
Expand Down
2 changes: 1 addition & 1 deletion app/boards/arm/adv360pro/adv360pro_right.dts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
};
};

&default_transform {
&matrix_transform0 {
col-offset = <10>;
};
20 changes: 20 additions & 0 deletions app/boards/arm/bdn9/bdn9_rev2-layouts.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <physical_layouts.dtsi>

/ {
physical_layout0: physical_layout_0 {
compatible = "zmk,physical-layout";
display-name = "BDN9";

keys // w h x y rot rx ry
= <&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 200 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 200 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 200 200 0 0 0>
;
};
};
34 changes: 9 additions & 25 deletions app/boards/arm/bdn9/bdn9_rev2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

#include <dt-bindings/zmk/matrix_transform.h>

#include <physical_layouts.dtsi>
#include "bdn9_rev2-layouts.dtsi"

&physical_layout0 {
transform = <&matrix_transform0>;
};

/ {
model = "Keeb.io BDN9 rev2";
Expand All @@ -20,13 +24,12 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan;
zmk,underglow = &led_strip;
zmk,physical-layout = &physical_layout0;
zmk,kscan = &kscan0;
};

matrix_transform: matrix_transform {
compatible = "zmk,matrix-transform";

matrix_transform0: matrix_transform_0 {
compatible = "zmk,matrix-transform";
columns = <3>;
rows = <3>;
Expand All @@ -37,26 +40,7 @@
>;
};

physical_layout {
compatible = "zmk,physical-layout";

display-name = "BDN9";
transform = <&matrix_transform>;

keys // w h x y rot rx ry
= <&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 200 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 200 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 200 200 0 0 0>
;
};

kscan: kscan {
kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-direct";

input-gpios
Expand Down
9 changes: 5 additions & 4 deletions app/boards/arm/ferris/ferris_rev02.dts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <layouts/cuddlykeyboards/ferris.dtsi>

&cuddlykeyboards_ferris_layout {
transform = <&transform>;
transform = <&matrix_transform0>;
};

/ {
Expand All @@ -23,13 +23,14 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan;
zmk,kscan = &kscan0;
zmk,physical-layout = &cuddlykeyboards_ferris_layout;
/* TODO: Enable once we support the IC for underglow
zmk,underglow = &led_strip;
*/
};

transform: transform {
matrix_transform0: matrix_transform0 {
compatible = "zmk,matrix-transform";
rows = <4>;
columns = <10>;
Expand All @@ -42,7 +43,7 @@
>;
};

kscan: kscan {
kscan0: kscan0 {
compatible = "zmk,kscan-composite";
rows = <4>;
columns = <10>;
Expand Down
Loading

0 comments on commit 192931c

Please sign in to comment.