diff --git a/app/boards/mechwild/pillbug/Kconfig.pillbug b/app/boards/mechwild/pillbug/Kconfig.pillbug index b8e0e1482..27482cc2f 100644 --- a/app/boards/mechwild/pillbug/Kconfig.pillbug +++ b/app/boards/mechwild/pillbug/Kconfig.pillbug @@ -3,6 +3,6 @@ config BOARD_PILLBUG select SOC_NRF52840_QIAA - imply RETAINED_MEM - imply RETENTION - imply RETENTION_BOOT_MODE + imply RETAINED_MEM if BOARD_PILLBUG_NRF52840_ZMK + imply RETENTION if BOARD_PILLBUG_NRF52840_ZMK + imply RETENTION_BOOT_MODE if BOARD_PILLBUG_NRF52840_ZMK diff --git a/app/boards/mechwild/pillbug/board.yml b/app/boards/mechwild/pillbug/board.yml index abd15044f..7e6a99597 100644 --- a/app/boards/mechwild/pillbug/board.yml +++ b/app/boards/mechwild/pillbug/board.yml @@ -1,5 +1,5 @@ board: name: pillbug - vendor: mechwild - socs: - - name: nrf52840 + variants: + - name: zmk + qualifier: nrf52840 diff --git a/app/boards/mechwild/pillbug/pillbug.zmk.yml b/app/boards/mechwild/pillbug/pillbug.zmk.yml index 5df11b9e0..397ce6537 100644 --- a/app/boards/mechwild/pillbug/pillbug.zmk.yml +++ b/app/boards/mechwild/pillbug/pillbug.zmk.yml @@ -1,5 +1,5 @@ file_format: "1" -id: pillbug +id: pillbug//zmk name: PillBug type: board arch: arm diff --git a/app/boards/mechwild/pillbug/pillbug_nrf52840_zmk.dts b/app/boards/mechwild/pillbug/pillbug_nrf52840_zmk.dts new file mode 100644 index 000000000..ff977338d --- /dev/null +++ b/app/boards/mechwild/pillbug/pillbug_nrf52840_zmk.dts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2026 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; + +#include <../boards/mechwild/pillbug/pillbug.dts> +#include + + +/ { + chosen { + zmk,battery = &vbatt; + }; + + + // Node name must match original "EXT_POWER" label to preserve user settings. + EXT_POWER { + compatible = "zmk,ext-power-generic"; + control-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; + init-delay-ms = <50>; + }; + + vbatt: vbatt { + compatible = "zmk,battery-voltage-divider"; + io-channels = <&adc 2>; + output-ohms = <2000000>; + full-ohms = <(2000000 + 820000)>; + }; +}; diff --git a/app/boards/mechwild/pillbug/pillbug_defconfig b/app/boards/mechwild/pillbug/pillbug_nrf52840_zmk_defconfig similarity index 100% rename from app/boards/mechwild/pillbug/pillbug_defconfig rename to app/boards/mechwild/pillbug/pillbug_nrf52840_zmk_defconfig diff --git a/app/boards/mechwild/pillbug/Kconfig b/app/module/boards/mechwild/pillbug/Kconfig similarity index 100% rename from app/boards/mechwild/pillbug/Kconfig rename to app/module/boards/mechwild/pillbug/Kconfig diff --git a/app/boards/mechwild/pillbug/Kconfig.defconfig b/app/module/boards/mechwild/pillbug/Kconfig.defconfig similarity index 100% rename from app/boards/mechwild/pillbug/Kconfig.defconfig rename to app/module/boards/mechwild/pillbug/Kconfig.defconfig diff --git a/app/module/boards/mechwild/pillbug/Kconfig.pillbug b/app/module/boards/mechwild/pillbug/Kconfig.pillbug new file mode 100644 index 000000000..d89679445 --- /dev/null +++ b/app/module/boards/mechwild/pillbug/Kconfig.pillbug @@ -0,0 +1,8 @@ +# Copyright (c) 2026 The ZMK Contributors +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_PILLBUG + select SOC_NRF52840_QIAA + imply RETAINED_MEM + imply RETENTION + imply RETENTION_BOOT_MODE diff --git a/app/boards/mechwild/pillbug/blackpill_pins.dtsi b/app/module/boards/mechwild/pillbug/blackpill_pins.dtsi similarity index 100% rename from app/boards/mechwild/pillbug/blackpill_pins.dtsi rename to app/module/boards/mechwild/pillbug/blackpill_pins.dtsi diff --git a/app/module/boards/mechwild/pillbug/board.cmake b/app/module/boards/mechwild/pillbug/board.cmake new file mode 100644 index 000000000..d9d4ed92e --- /dev/null +++ b/app/module/boards/mechwild/pillbug/board.cmake @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: MIT + +set(OPENOCD_NRF5_SUBFAMILY nrf52) +board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") +include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake) diff --git a/app/module/boards/mechwild/pillbug/board.yml b/app/module/boards/mechwild/pillbug/board.yml new file mode 100644 index 000000000..abd15044f --- /dev/null +++ b/app/module/boards/mechwild/pillbug/board.yml @@ -0,0 +1,5 @@ +board: + name: pillbug + vendor: mechwild + socs: + - name: nrf52840 diff --git a/app/module/boards/mechwild/pillbug/pillbug-pinctrl.dtsi b/app/module/boards/mechwild/pillbug/pillbug-pinctrl.dtsi new file mode 100644 index 000000000..609c4a725 --- /dev/null +++ b/app/module/boards/mechwild/pillbug/pillbug-pinctrl.dtsi @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2026 The ZMK Contributors + * SPDX-License-Identifier: MIT + */ + +&pinctrl { + uart0_default: uart0_default { + group1 { + psels = ; + bias-pull-up; + }; + group2 { + psels = ; + }; + }; + + uart0_sleep: uart0_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c0_default: i2c0_default { + group1 { + psels = , + ; + }; + }; + + i2c0_sleep: i2c0_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + spi1_default: spi1_default { + group1 { + psels = , + , + ; + }; + }; + + spi1_sleep: spi1_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; diff --git a/app/boards/mechwild/pillbug/pillbug.dts b/app/module/boards/mechwild/pillbug/pillbug.dts similarity index 80% rename from app/boards/mechwild/pillbug/pillbug.dts rename to app/module/boards/mechwild/pillbug/pillbug.dts index cb2db7c46..b24f05df5 100644 --- a/app/boards/mechwild/pillbug/pillbug.dts +++ b/app/module/boards/mechwild/pillbug/pillbug.dts @@ -7,7 +7,6 @@ /dts-v1/; #include -#include #include "pillbug-pinctrl.dtsi" #include "blackpill_pins.dtsi" @@ -20,7 +19,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zmk,battery = &vbatt; }; leds { @@ -29,20 +27,6 @@ gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; }; }; - - // Node name must match original "EXT_POWER" label to preserve user settings. - EXT_POWER { - compatible = "zmk,ext-power-generic"; - control-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; - init-delay-ms = <50>; - }; - - vbatt: vbatt { - compatible = "zmk,battery-voltage-divider"; - io-channels = <&adc 2>; - output-ohms = <2000000>; - full-ohms = <(2000000 + 820000)>; - }; }; &adc { @@ -88,7 +72,6 @@ zephyr_udc0: &usbd { status = "okay"; }; - &flash0 { /* * For more information, see: diff --git a/app/boards/mechwild/pillbug/pillbug.yaml b/app/module/boards/mechwild/pillbug/pillbug.yaml similarity index 100% rename from app/boards/mechwild/pillbug/pillbug.yaml rename to app/module/boards/mechwild/pillbug/pillbug.yaml diff --git a/app/module/boards/mechwild/pillbug/pillbug_defconfig b/app/module/boards/mechwild/pillbug/pillbug_defconfig new file mode 100644 index 000000000..8332d62ba --- /dev/null +++ b/app/module/boards/mechwild/pillbug/pillbug_defconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2026 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Enable MPU +CONFIG_ARM_MPU=y + +# Use pinctrl +CONFIG_PINCTRL=y + +# enable GPIO +CONFIG_GPIO=y + +CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_BUILD_OUTPUT_UF2=y diff --git a/app/boards/mechwild/pillbug/pre_dt_board.cmake b/app/module/boards/mechwild/pillbug/pre_dt_board.cmake similarity index 100% rename from app/boards/mechwild/pillbug/pre_dt_board.cmake rename to app/module/boards/mechwild/pillbug/pre_dt_board.cmake