From 37c0533875e75b016f32ec618975f655324a6e9f Mon Sep 17 00:00:00 2001 From: Exentio Date: Sun, 19 Dec 2021 22:32:38 +0100 Subject: [PATCH] mf68 builds for Pro Micro by default --- app/boards/shields/mf68/Kconfig.defconfig | 7 ++ app/boards/shields/mf68/Kconfig.shield | 3 + app/boards/shields/mf68/README.md | 4 +- app/boards/shields/mf68/mf68.dtsi | 41 ++++++++ app/boards/shields/mf68/mf68.overlay | 105 +++++-------------- app/boards/shields/mf68/mf68_feather.overlay | 31 ++++++ 6 files changed, 108 insertions(+), 83 deletions(-) create mode 100644 app/boards/shields/mf68/mf68.dtsi create mode 100644 app/boards/shields/mf68/mf68_feather.overlay diff --git a/app/boards/shields/mf68/Kconfig.defconfig b/app/boards/shields/mf68/Kconfig.defconfig index e545d9c6..e9a8ef1c 100644 --- a/app/boards/shields/mf68/Kconfig.defconfig +++ b/app/boards/shields/mf68/Kconfig.defconfig @@ -7,3 +7,10 @@ config ZMK_KEYBOARD_NAME default "MF68" endif + +if SHIELD_MF68_FEATHER + +config ZMK_KEYBOARD_NAME + default "MF68" + +endif diff --git a/app/boards/shields/mf68/Kconfig.shield b/app/boards/shields/mf68/Kconfig.shield index ff5656c1..c3cade28 100644 --- a/app/boards/shields/mf68/Kconfig.shield +++ b/app/boards/shields/mf68/Kconfig.shield @@ -3,3 +3,6 @@ config SHIELD_MF68 def_bool $(shields_list_contains,mf68) + +config SHIELD_MF68_FEATHER + def_bool $(shields_list_contains,mf68_feather) diff --git a/app/boards/shields/mf68/README.md b/app/boards/shields/mf68/README.md index a3390f82..41b7f5ad 100644 --- a/app/boards/shields/mf68/README.md +++ b/app/boards/shields/mf68/README.md @@ -3,8 +3,6 @@ Replacement MagicForce 68 PCB designed by [di0ib](https://github.com/di0ib). Hardware repo: https://github.com/di0ib/tmk_keyboard/tree/master/keyboard/mf68 -This shield is made to be easily used with an Adafruit Feather nRF52840 Express, and the default pin order is optimized for that board. For use with a Pro Micro-compatible controller, comment lines 21-41 and uncomment lines 44-64 in `mf68.overlay`. - ## Features - Designed for Pro Micro boards @@ -16,6 +14,8 @@ This shield is made to be easily used with an Adafruit Feather nRF52840 Express, ## Use with an Adafruit Feather nRF52840 Express +Build with `west build -p -d build/feather -b adafruit_feather_nrf52840 -- -DSHIELD=mf68_feather`. + ### Pinout | Pro Micro Left | Feather Left | Feather Right | Pro Micro Right | diff --git a/app/boards/shields/mf68/mf68.dtsi b/app/boards/shields/mf68/mf68.dtsi new file mode 100644 index 00000000..f43e7622 --- /dev/null +++ b/app/boards/shields/mf68/mf68.dtsi @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + diode-direction = "col2row"; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <9>; + rows = <8>; + +// | MX1 | MX2 | MX3 | MX4 | MX5 | MX6 | MX7 | MX8 | MX9 | MX10 | MX11 | MX12 | MX13 | MX14 | MX15 | MX16 | +// | MX17 | MX18 | MX19 | MX20 | MX21 | MX22 | MX23 | MX24 | MX25 | MX26 | MX27 | MX28 | MX29 | MX30 | MX31 | MX32 | +// | MX33 | MX34 | MX35 | MX36 | MX37 | MX38 | MX39 | MX40 | MX41 | MX42 | MX43 | MX44 | MX45 | +// | MX46 | MX47 | MX48 | MX49 | MX50 | MX51 | MX52 | MX53 | MX54 | MX55 | MX56 | MX57 | MX58 | +// | MX59 | MX60 | MX61 | MX62 | MX63 | MX64 | MX65 | MX66 | MX67 | MX68 | + + 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(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(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(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) +RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) +RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) RC(5,6) RC(5,7) RC(5,8) RC(6,0) RC(6,1) RC(6,2) RC(6,3) +RC(6,4) RC(6,5) RC(6,6) RC(6,7) RC(6,8) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4) + >; + }; +}; + diff --git a/app/boards/shields/mf68/mf68.overlay b/app/boards/shields/mf68/mf68.overlay index 714f2969..14bf55c5 100644 --- a/app/boards/shields/mf68/mf68.overlay +++ b/app/boards/shields/mf68/mf68.overlay @@ -4,85 +4,28 @@ * SPDX-License-Identifier: MIT */ -#include - -/ { - chosen { - zmk,kscan = &kscan0; - zmk,matrix_transform = &default_transform; - }; - - kscan0: kscan { - compatible = "zmk,kscan-gpio-matrix"; - label = "KSCAN"; - diode-direction = "col2row"; - - // Adafruit Feather nRF52840 Express - row-gpios - = <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* A0 */ - , <&gpio1 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D13 */ - , <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D12 */ - , <&gpio0 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D11 */ - , <&gpio0 27 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D10 */ - , <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D9 */ - , <&gpio0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D6 */ - , <&gpio1 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D5 */ - ; - col-gpios - = <&gpio0 30 GPIO_ACTIVE_HIGH> /* A2 */ - , <&gpio0 28 GPIO_ACTIVE_HIGH> /* A3 */ - , <&gpio0 2 GPIO_ACTIVE_HIGH> /* A4 */ - , <&gpio0 3 GPIO_ACTIVE_HIGH> /* A5 */ - , <&gpio0 14 GPIO_ACTIVE_HIGH> /* SCK */ - , <&gpio0 13 GPIO_ACTIVE_HIGH> /* MOSI */ - , <&gpio0 15 GPIO_ACTIVE_HIGH> /* MISO */ - , <&gpio0 24 GPIO_ACTIVE_HIGH> /* RXD */ - , <&gpio0 25 GPIO_ACTIVE_HIGH> /* TXD */ - ; - - /* Pro Micro - row-gpios - = <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - ; - col-gpios - = <&pro_micro 1 GPIO_ACTIVE_HIGH> - , <&pro_micro 0 GPIO_ACTIVE_HIGH> - , <&pro_micro 2 GPIO_ACTIVE_HIGH> - , <&pro_micro 3 GPIO_ACTIVE_HIGH> - , <&pro_micro 4 GPIO_ACTIVE_HIGH> - , <&pro_micro 5 GPIO_ACTIVE_HIGH> - , <&pro_micro 6 GPIO_ACTIVE_HIGH> - , <&pro_micro 7 GPIO_ACTIVE_HIGH> - , <&pro_micro 8 GPIO_ACTIVE_HIGH> - ; - */ - }; - - default_transform: keymap_transform_0 { - compatible = "zmk,matrix-transform"; - columns = <9>; - rows = <8>; - -// | MX1 | MX2 | MX3 | MX4 | MX5 | MX6 | MX7 | MX8 | MX9 | MX10 | MX11 | MX12 | MX13 | MX14 | MX15 | MX16 | -// | MX17 | MX18 | MX19 | MX20 | MX21 | MX22 | MX23 | MX24 | MX25 | MX26 | MX27 | MX28 | MX29 | MX30 | MX31 | MX32 | -// | MX33 | MX34 | MX35 | MX36 | MX37 | MX38 | MX39 | MX40 | MX41 | MX42 | MX43 | MX44 | MX45 | -// | MX46 | MX47 | MX48 | MX49 | MX50 | MX51 | MX52 | MX53 | MX54 | MX55 | MX56 | MX57 | MX58 | -// | MX59 | MX60 | MX61 | MX62 | MX63 | MX64 | MX65 | MX66 | MX67 | MX68 | - - 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(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(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(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) -RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) -RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) RC(5,6) RC(5,7) RC(5,8) RC(6,0) RC(6,1) RC(6,2) RC(6,3) -RC(6,4) RC(6,5) RC(6,6) RC(6,7) RC(6,8) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4) - >; - }; -}; +#include "mf68.dtsi" +&kscan0 { + row-gpios + = <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + col-gpios + = <&pro_micro 1 GPIO_ACTIVE_HIGH> + , <&pro_micro 0 GPIO_ACTIVE_HIGH> + , <&pro_micro 2 GPIO_ACTIVE_HIGH> + , <&pro_micro 3 GPIO_ACTIVE_HIGH> + , <&pro_micro 4 GPIO_ACTIVE_HIGH> + , <&pro_micro 5 GPIO_ACTIVE_HIGH> + , <&pro_micro 6 GPIO_ACTIVE_HIGH> + , <&pro_micro 7 GPIO_ACTIVE_HIGH> + , <&pro_micro 8 GPIO_ACTIVE_HIGH> + ; +}; \ No newline at end of file diff --git a/app/boards/shields/mf68/mf68_feather.overlay b/app/boards/shields/mf68/mf68_feather.overlay new file mode 100644 index 00000000..de4d386e --- /dev/null +++ b/app/boards/shields/mf68/mf68_feather.overlay @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "mf68.dtsi" + +&kscan0 { + row-gpios + = <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* A0 */ + , <&gpio1 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D13 */ + , <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D12 */ + , <&gpio0 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D11 */ + , <&gpio0 27 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D10 */ + , <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D9 */ + , <&gpio0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D6 */ + , <&gpio1 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> /* D5 */ + ; + col-gpios + = <&gpio0 30 GPIO_ACTIVE_HIGH> /* A2 */ + , <&gpio0 28 GPIO_ACTIVE_HIGH> /* A3 */ + , <&gpio0 2 GPIO_ACTIVE_HIGH> /* A4 */ + , <&gpio0 3 GPIO_ACTIVE_HIGH> /* A5 */ + , <&gpio0 14 GPIO_ACTIVE_HIGH> /* SCK */ + , <&gpio0 13 GPIO_ACTIVE_HIGH> /* MOSI */ + , <&gpio0 15 GPIO_ACTIVE_HIGH> /* MISO */ + , <&gpio0 24 GPIO_ACTIVE_HIGH> /* RXD */ + , <&gpio0 25 GPIO_ACTIVE_HIGH> /* TXD */ + ; +}; \ No newline at end of file