diff --git a/app/boards/shields/boardsource3x4/boardsource3x4-layouts.dtsi b/app/boards/shields/boardsource3x4/boardsource3x4-layouts.dtsi new file mode 100644 index 000000000..0bbee3bd6 --- /dev/null +++ b/app/boards/shields/boardsource3x4/boardsource3x4-layouts.dtsi @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + 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 = ; + }; + vertical_map: verctical { + // A B C + // 7 8 9 + // 4 5 6 + // 1 2 3 + physical-layout = <&vertical_physical_layout>; + positions = ; + }; + }; + +}; diff --git a/app/boards/shields/boardsource3x4/boardsource3x4.keymap b/app/boards/shields/boardsource3x4/boardsource3x4.keymap index c0a23b123..5648d2359 100644 --- a/app/boards/shields/boardsource3x4/boardsource3x4.keymap +++ b/app/boards/shields/boardsource3x4/boardsource3x4.keymap @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 The ZMK Contributors + * Copyright (c) 2025 The ZMK Contributors * * SPDX-License-Identifier: MIT */ @@ -37,7 +37,7 @@ bindings = < &bt BT_CLR &none &sys_reset &bootloader &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 >; }; diff --git a/app/boards/shields/boardsource3x4/boardsource3x4.overlay b/app/boards/shields/boardsource3x4/boardsource3x4.overlay index 0d63214dd..37d0c3fcf 100644 --- a/app/boards/shields/boardsource3x4/boardsource3x4.overlay +++ b/app/boards/shields/boardsource3x4/boardsource3x4.overlay @@ -1,14 +1,47 @@ /* - * Copyright (c) 2020 The ZMK Contributors + * Copyright (c) 2025 The ZMK Contributors * * SPDX-License-Identifier: MIT */ #include +#include "boardsource3x4-layouts.dtsi" + + +&horizontal_physical_layout { + transform = <&horizontal_transform>; +}; +&vertical_physical_layout { + transform = <&vertical_transform>; +}; / { chosen { 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 { diff --git a/app/boards/shields/boardsource3x4/boardsource3x4.zmk.yml b/app/boards/shields/boardsource3x4/boardsource3x4.zmk.yml index fee279659..eee7fa40f 100644 --- a/app/boards/shields/boardsource3x4/boardsource3x4.zmk.yml +++ b/app/boards/shields/boardsource3x4/boardsource3x4.zmk.yml @@ -6,3 +6,4 @@ url: https://boardsource.xyz/store/5ecc2008eee64242946c98c1 requires: [pro_micro] features: - keys + - studio