feat(shields): Add Studio support to boardsource3x4 (#3154)

* feat(shields): Add Studio support to boardsource3x4

* rename default transform

* add position maps
This commit is contained in:
snoyer 2025-12-28 12:32:42 +04:00 committed by GitHub
parent a9e0befcb6
commit 40e06f3c00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 107 additions and 3 deletions

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2025 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <physical_layouts.dtsi>
/ {
horizontal_physical_layout: horizontal_physical_layout {
compatible = "zmk,physical-layout";
display-name = "Horizontal Layout";
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 200 0 0 0 0>
, <&key_physical_attrs 100 100 300 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 300 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>
, <&key_physical_attrs 100 100 300 200 0 0 0>
;
};
vertical_physical_layout: vertical_physical_layout {
compatible = "zmk,physical-layout";
display-name = "Vertical Layout";
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 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>
, <&key_physical_attrs 100 100 0 300 0 0 0>
, <&key_physical_attrs 100 100 100 300 0 0 0>
, <&key_physical_attrs 100 100 200 300 0 0 0>
;
};
position_map {
compatible = "zmk,physical-layout-position-map";
horizontal_map: horizontal {
// A 7 8 9
// B 4 5 6
// C 1 2 3
physical-layout = <&horizontal_physical_layout>;
positions = </* 0 */ 1 2 3 4 5 6 7 8 /* 9 10 11 */>;
};
vertical_map: verctical {
// A B C
// 7 8 9
// 4 5 6
// 1 2 3
physical-layout = <&vertical_physical_layout>;
positions = </* 0 */ 3 4 5 1 6 7 8 2 /* 9 10 11 */>;
};
};
};

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020 The ZMK Contributors * Copyright (c) 2025 The ZMK Contributors
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
@ -37,7 +37,7 @@
bindings = < bindings = <
&bt BT_CLR &none &sys_reset &bootloader &bt BT_CLR &none &sys_reset &bootloader
&trans &bt BT_SEL 3 &bt BT_SEL 4 &none &trans &bt BT_SEL 3 &bt BT_SEL 4 &none
&none &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &studio_unlock &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2
>; >;
}; };

View File

@ -1,14 +1,47 @@
/* /*
* Copyright (c) 2020 The ZMK Contributors * Copyright (c) 2025 The ZMK Contributors
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
#include <dt-bindings/zmk/matrix_transform.h> #include <dt-bindings/zmk/matrix_transform.h>
#include "boardsource3x4-layouts.dtsi"
&horizontal_physical_layout {
transform = <&horizontal_transform>;
};
&vertical_physical_layout {
transform = <&vertical_transform>;
};
/ { / {
chosen { chosen {
zmk,kscan = &kscan0; zmk,kscan = &kscan0;
zmk,physical-layout = &horizontal_physical_layout;
};
horizontal_transform: horizontal_transform {
compatible = "zmk,matrix-transform";
columns = <4>;
rows = <3>;
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3)
RC(1,0) RC(1,1) RC(1,2) RC(1,3)
RC(2,0) RC(2,1) RC(2,2) RC(2,3)
>;
};
vertical_transform: vertical_transform {
compatible = "zmk,matrix-transform";
columns = <4>;
rows = <3>;
map = <
RC(0,3) RC(1,3) RC(2,3)
RC(0,2) RC(1,2) RC(2,2)
RC(0,1) RC(1,1) RC(2,1)
RC(0,0) RC(1,0) RC(2,0)
>;
}; };
kscan0: kscan { kscan0: kscan {

View File

@ -6,3 +6,4 @@ url: https://boardsource.xyz/store/5ecc2008eee64242946c98c1
requires: [pro_micro] requires: [pro_micro]
features: features:
- keys - keys
- studio