-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Nick-Munnich
wants to merge
3
commits into
zmkfirmware:main
from
Nick-Munnich:physical-layouts-refactor
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
|
||
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> | ||
; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.