Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Moved all layouts into their own files #2582

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions app/boards/arm/adv360pro/adv360pro-layouts.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#include <physical_layouts.dtsi>

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

transform = <&default_transform>;
kscan = <&kscan0>;
Comment on lines +8 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really stuck on this aspect of the refactor. In particular, this makes this import still highly coupled with the importing environment, and makes it harder to refactor without surprising side effects. It also makes it so that future refactors that might identify "Hey, this layout is actually useful, and should be shared!" requires extracting this coupling later anyways.

It also leads to a "two ways to do things" situation, between "using shared layouts" and "using local layouts" that would potentially lead to more confusion. IMHO, I favor Joel's first proposed option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd like consistency between the shared and the local approaches on this point, which way around it goes I'm not too fussy about. That option is a bit ugly, but justifiable imo. What would your thoughts be on applying option 2 to all the shared layouts?

I do think that option 1 should be used for binding kscans to physical transforms when different kscans are used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO matrix transforms are just as tightly coupled to the "host" that is going to inject them, and shouldn't be set either.


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>
;
};
};
90 changes: 1 addition & 89 deletions app/boards/arm/adv360pro/adv360pro.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#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"

/ {
Expand All @@ -23,7 +22,6 @@
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;
Expand All @@ -46,92 +44,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
23 changes: 23 additions & 0 deletions app/boards/arm/bdn9/bdn9_rev2-layouts.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <physical_layouts.dtsi>

/{
default_layout: physical_layout {
compatible = "zmk,physical-layout";
display-name = "BDN9";

transform = <&matrix_transform>;
kscan = <&kscan>;

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>
;
};
};
23 changes: 2 additions & 21 deletions app/boards/arm/bdn9/bdn9_rev2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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

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

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

matrix_transform: matrix_transform {
Expand All @@ -37,25 +37,6 @@
>;
};

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 {
compatible = "zmk,kscan-gpio-direct";

Expand Down
20 changes: 20 additions & 0 deletions app/boards/arm/bt60/bt60_v1-layouts.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <layouts/common/60percent/all1u.dtsi>
#include <layouts/common/60percent/ansi.dtsi>
#include <layouts/common/60percent/hhkb.dtsi>
#include <layouts/common/60percent/iso.dtsi>

&layout_60_ansi {
transform = <&ansi_transform>;
};

&layout_60_iso {
transform = <&iso_transform>;
};

&layout_60_all1u {
transform = <&all_1u_transform>;
};

&layout_60_hhkb {
transform = <&hhkb_transform>;
};
22 changes: 1 addition & 21 deletions app/boards/arm/bt60/bt60_v1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

/dts-v1/;
#include "bt60.dtsi"
#include <layouts/common/60percent/all1u.dtsi>
#include <layouts/common/60percent/ansi.dtsi>
#include <layouts/common/60percent/hhkb.dtsi>
#include <layouts/common/60percent/iso.dtsi>

#include "bt60_v1-layouts.dtsi"

/ {
chosen {
Expand Down Expand Up @@ -103,19 +99,3 @@
;
};
};

&layout_60_ansi {
transform = <&ansi_transform>;
};

&layout_60_iso {
transform = <&iso_transform>;
};

&layout_60_all1u {
transform = <&all_1u_transform>;
};

&layout_60_hhkb {
transform = <&hhkb_transform>;
};
5 changes: 5 additions & 0 deletions app/boards/arm/bt60/bt60_v1_hs-layouts.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <layouts/common/60percent/ansi.dtsi>

&layout_60_ansi {
transform = <&default_transform>;
};
6 changes: 1 addition & 5 deletions app/boards/arm/bt60/bt60_v1_hs.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/dts-v1/;
#include "bt60.dtsi"
#include <layouts/common/60percent/ansi.dtsi>
#include "bt60_v1_hs-layouts.dtsi"

/ {
chosen {
Expand Down Expand Up @@ -60,7 +60,3 @@
;
};
};

&layout_60_ansi {
transform = <&default_transform>;
};
20 changes: 20 additions & 0 deletions app/boards/arm/ckp/bt60_v2-layouts.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <layouts/common/60percent/all1u.dtsi>
#include <layouts/common/60percent/ansi.dtsi>
#include <layouts/common/60percent/hhkb.dtsi>
#include <layouts/common/60percent/iso.dtsi>

&layout_60_ansi {
transform = <&ansi_transform>;
};

&layout_60_iso {
transform = <&iso_transform>;
};

&layout_60_all1u {
transform = <&all_1u_transform>;
};

&layout_60_hhkb {
transform = <&hhkb_transform>;
};
Loading