Skip to content

Commit

Permalink
feat: Add shared layout .dtsi files to promote reuse.
Browse files Browse the repository at this point in the history
* Add Corne and Ferris shared layouts, and update the respective
  shields to use them.
* Add a sample Hummingbird physical layout for testing posix xiao.
* Add Sofle physical layout as an additional reference.
  • Loading branch information
petejohanson committed Aug 30, 2024
1 parent 58b77ad commit 7592958
Show file tree
Hide file tree
Showing 8 changed files with 331 additions and 46 deletions.
40 changes: 7 additions & 33 deletions app/boards/shields/corne/corne.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,17 @@

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

#include <layouts/foostan/corne.dtsi>

// For backwards compatibility
default_transform: &foostan_corne_6col_transform {};
five_column_transform: &foostan_corne_5col_transform {};

/ {
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
};

default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <4>;
// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 |
// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 |
// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11)
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11)
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
>;
};

five_column_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <10>;
rows = <4>;
// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 |
// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 |
// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 |
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
map = <
RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10)
RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10)
RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10)
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
>;
zmk,physical-layout = &foostan_corne_6col_layout;
};

kscan0: kscan {
Expand Down
4 changes: 2 additions & 2 deletions app/boards/shields/corne/corne_right.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

#include "corne.dtsi"

&default_transform {
&foostan_corne_6col_transform {
col-offset = <6>;
};

&five_column_transform {
&foostan_corne_5col_transform {
col-offset = <6>;
};

Expand Down
5 changes: 2 additions & 3 deletions app/boards/shields/cradio/cradio.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
*/

#include <dt-bindings/zmk/matrix_transform.h>
#include <layouts/cuddlykeyboards/ferris.dtsi>

/ {

chosen {
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
};

default_transform: keymap_transform_0 {
cuddlykeyboards_ferris_transform: cuddlykeyboards_ferris_transform {
compatible = "zmk,matrix-transform";
columns = <34>;
rows = <1>;
Expand Down
2 changes: 1 addition & 1 deletion app/boards/shields/cradio/cradio_right.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

#include "cradio.dtsi"

&default_transform {
&cuddlykeyboards_ferris_transform {
col-offset = <17>;
};
49 changes: 43 additions & 6 deletions app/boards/shields/hummingbird/hummingbird.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

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

#include <physical_layouts.dtsi>

/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
/delete-property/ zephyr,console;
/delete-property/ zephyr,shell-uart;
};

default_transform: keymap_transform_0 {
Expand Down Expand Up @@ -51,7 +50,45 @@
;
};

};

&xiao_spi { status = "disabled"; };
&xiao_serial { status = "disabled"; };
layout_0: layout_0 {
compatible = "zmk,physical-layout";
display-name = "Default";

transform = <&default_transform>;

keys // w h x y rot rx ry
= <&key_physical_attrs 100 100 0 75 0 0 0>
, <&key_physical_attrs 100 100 100 25 0 0 0>
, <&key_physical_attrs 100 100 200 0 0 0 0>
, <&key_physical_attrs 100 100 300 25 0 0 0>
, <&key_physical_attrs 100 100 400 75 0 0 0>
, <&key_physical_attrs 100 100 600 75 0 0 0>
, <&key_physical_attrs 100 100 700 25 0 0 0>
, <&key_physical_attrs 100 100 800 0 0 0 0>
, <&key_physical_attrs 100 100 900 25 0 0 0>
, <&key_physical_attrs 100 100 1000 75 0 0 0>
, <&key_physical_attrs 100 100 0 175 0 0 0>
, <&key_physical_attrs 100 100 100 125 0 0 0>
, <&key_physical_attrs 100 100 200 100 0 0 0>
, <&key_physical_attrs 100 100 300 125 0 0 0>
, <&key_physical_attrs 100 100 400 175 0 0 0>
, <&key_physical_attrs 100 100 600 175 0 0 0>
, <&key_physical_attrs 100 100 700 125 0 0 0>
, <&key_physical_attrs 100 100 800 100 0 0 0>
, <&key_physical_attrs 100 100 900 125 0 0 0>
, <&key_physical_attrs 100 100 1000 175 0 0 0>
, <&key_physical_attrs 100 100 100 225 0 0 0>
, <&key_physical_attrs 100 100 200 200 0 0 0>
, <&key_physical_attrs 100 100 300 225 0 0 0>
, <&key_physical_attrs 100 100 700 225 0 0 0>
, <&key_physical_attrs 100 100 800 200 0 0 0>
, <&key_physical_attrs 100 100 900 225 0 0 0>
, <&key_physical_attrs 100 100 325 350 0 0 0>
, <&key_physical_attrs 100 100 425 375 0 0 0>
, <&key_physical_attrs 100 100 575 375 0 0 0>
, <&key_physical_attrs 100 100 675 350 0 0 0>
;
};

};
73 changes: 72 additions & 1 deletion app/boards/shields/sofle/sofle.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
*/

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

/ {
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
zmk,physical-layout = &layout;
};

default_transform: keymap_transform_0 {
Expand Down Expand Up @@ -45,6 +46,76 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
;
};

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

transform = <&default_transform>;

keys // w h x y rot rx ry
= <&key_physical_attrs 100 100 0 37 0 0 0>
, <&key_physical_attrs 100 100 100 37 0 0 0>
, <&key_physical_attrs 100 100 200 12 0 0 0>
, <&key_physical_attrs 100 100 300 0 0 0 0>
, <&key_physical_attrs 100 100 400 12 0 0 0>
, <&key_physical_attrs 100 100 500 24 0 0 0>
, <&key_physical_attrs 100 100 900 24 0 0 0>
, <&key_physical_attrs 100 100 1000 12 0 0 0>
, <&key_physical_attrs 100 100 1100 0 0 0 0>
, <&key_physical_attrs 100 100 1200 12 0 0 0>
, <&key_physical_attrs 100 100 1300 37 0 0 0>
, <&key_physical_attrs 100 100 1400 37 0 0 0>
, <&key_physical_attrs 100 100 0 137 0 0 0>
, <&key_physical_attrs 100 100 100 137 0 0 0>
, <&key_physical_attrs 100 100 200 112 0 0 0>
, <&key_physical_attrs 100 100 300 100 0 0 0>
, <&key_physical_attrs 100 100 400 112 0 0 0>
, <&key_physical_attrs 100 100 500 124 0 0 0>
, <&key_physical_attrs 100 100 900 124 0 0 0>
, <&key_physical_attrs 100 100 1000 112 0 0 0>
, <&key_physical_attrs 100 100 1100 100 0 0 0>
, <&key_physical_attrs 100 100 1200 112 0 0 0>
, <&key_physical_attrs 100 100 1300 137 0 0 0>
, <&key_physical_attrs 100 100 1400 137 0 0 0>
, <&key_physical_attrs 100 100 0 237 0 0 0>
, <&key_physical_attrs 100 100 100 237 0 0 0>
, <&key_physical_attrs 100 100 200 212 0 0 0>
, <&key_physical_attrs 100 100 300 200 0 0 0>
, <&key_physical_attrs 100 100 400 212 0 0 0>
, <&key_physical_attrs 100 100 500 224 0 0 0>
, <&key_physical_attrs 100 100 900 224 0 0 0>
, <&key_physical_attrs 100 100 1000 212 0 0 0>
, <&key_physical_attrs 100 100 1100 200 0 0 0>
, <&key_physical_attrs 100 100 1200 212 0 0 0>
, <&key_physical_attrs 100 100 1300 237 0 0 0>
, <&key_physical_attrs 100 100 1400 237 0 0 0>
, <&key_physical_attrs 100 100 0 337 0 0 0>
, <&key_physical_attrs 100 100 100 337 0 0 0>
, <&key_physical_attrs 100 100 200 312 0 0 0>
, <&key_physical_attrs 100 100 300 300 0 0 0>
, <&key_physical_attrs 100 100 400 312 0 0 0>
, <&key_physical_attrs 100 100 500 324 0 0 0>
, <&key_physical_attrs 100 100 600 274 0 0 0>
, <&key_physical_attrs 100 100 800 274 0 0 0>
, <&key_physical_attrs 100 100 900 324 0 0 0>
, <&key_physical_attrs 100 100 1000 312 0 0 0>
, <&key_physical_attrs 100 100 1100 300 0 0 0>
, <&key_physical_attrs 100 100 1200 312 0 0 0>
, <&key_physical_attrs 100 100 1300 337 0 0 0>
, <&key_physical_attrs 100 100 1400 337 0 0 0>
, <&key_physical_attrs 100 100 175 437 0 0 0>
, <&key_physical_attrs 100 100 275 412 0 0 0>
, <&key_physical_attrs 100 100 375 412 0 0 0>
, <&key_physical_attrs 100 100 490 412 1200 490 412>
, <&key_physical_attrs 100 150 600 383 2400 600 433>
, <&key_physical_attrs 100 150 800 383 (-2400) 900 433>
, <&key_physical_attrs 100 100 910 412 (-1200) 1010 412>
, <&key_physical_attrs 100 100 1025 412 0 0 0>
, <&key_physical_attrs 100 100 1125 412 0 0 0>
, <&key_physical_attrs 100 100 1225 437 0 0 0>
;
};

left_encoder: encoder_left {
compatible = "alps,ec11";
a-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
Expand Down
47 changes: 47 additions & 0 deletions app/dts/layouts/cuddlykeyboards/ferris.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <physical_layouts.dtsi>

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

transform = <&cuddlykeyboards_ferris_transform>;

keys // w h x y rot rx ry
= <&key_physical_attrs 100 100 0 95 0 0 0>
, <&key_physical_attrs 100 100 100 32 0 0 0>
, <&key_physical_attrs 100 100 200 0 0 0 0>
, <&key_physical_attrs 100 100 300 28 0 0 0>
, <&key_physical_attrs 100 100 400 42 0 0 0>
, <&key_physical_attrs 100 100 700 42 0 0 0>
, <&key_physical_attrs 100 100 800 28 0 0 0>
, <&key_physical_attrs 100 100 900 0 0 0 0>
, <&key_physical_attrs 100 100 1000 32 0 0 0>
, <&key_physical_attrs 100 100 1100 95 0 0 0>
, <&key_physical_attrs 100 100 0 195 0 0 0>
, <&key_physical_attrs 100 100 100 132 0 0 0>
, <&key_physical_attrs 100 100 200 100 0 0 0>
, <&key_physical_attrs 100 100 300 129 0 0 0>
, <&key_physical_attrs 100 100 400 142 0 0 0>
, <&key_physical_attrs 100 100 700 142 0 0 0>
, <&key_physical_attrs 100 100 800 129 0 0 0>
, <&key_physical_attrs 100 100 900 100 0 0 0>
, <&key_physical_attrs 100 100 1000 132 0 0 0>
, <&key_physical_attrs 100 100 1100 195 0 0 0>
, <&key_physical_attrs 100 100 0 295 0 0 0>
, <&key_physical_attrs 100 100 100 231 0 0 0>
, <&key_physical_attrs 100 100 200 200 0 0 0>
, <&key_physical_attrs 100 100 300 229 0 0 0>
, <&key_physical_attrs 100 100 400 242 0 0 0>
, <&key_physical_attrs 100 100 700 242 0 0 0>
, <&key_physical_attrs 100 100 800 229 0 0 0>
, <&key_physical_attrs 100 100 900 200 0 0 0>
, <&key_physical_attrs 100 100 1000 231 0 0 0>
, <&key_physical_attrs 100 100 1100 295 0 0 0>
, <&key_physical_attrs 100 100 330 355 1500 430 455>
, <&key_physical_attrs 100 100 430 355 3000 430 455>
, <&key_physical_attrs 100 100 670 355 (-3000) 770 455>
, <&key_physical_attrs 100 100 770 355 (-1500) 770 455>
;
};
};
Loading

0 comments on commit 7592958

Please sign in to comment.