refactor(boards): Move nRF52840 M2 to ZMK variant by default

Make the standard nRF52840 M2 board ID be `nrf52840_m2/nrf52840/zmk` or
`nrf52840_m2//zmk` by shorthand.
This commit is contained in:
Peter Johanson 2026-01-13 18:51:53 -07:00
parent 80ff833e28
commit 10c252fee5
15 changed files with 87 additions and 19 deletions

View File

@ -3,6 +3,6 @@
config BOARD_NRF52840_M2
select SOC_NRF52840_QIAA
imply RETAINED_MEM
imply RETENTION
imply RETENTION_BOOT_MODE
imply RETAINED_MEM if BOARD_NRF52840_M2_NRF52840_ZMK
imply RETENTION if BOARD_NRF52840_M2_NRF52840_ZMK
imply RETENTION_BOOT_MODE if BOARD_NRF52840_M2_NRF52840_ZMK

View File

@ -1,5 +1,5 @@
board:
name: nrf52840_m2
vendor: makerdiary
socs:
- name: nrf52840
extend: nrf52840_m2
variants:
- name: zmk
qualifier: nrf52840

View File

@ -1,5 +1,5 @@
file_format: "1"
id: nrf52840_m2
id: nrf52840_m2//zmk
name: nRF52840 M.2 Module
type: board
arch: arm

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2026 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <../boards/makerdiary/nrf52840_m2/nrf52840_m2.dts>
#include <common/nordic/nrf52840_uf2_boot_mode.dtsi>
/ {
model = "Makerdiary nRF52840 M.2 module";
compatible = "makerdiary,nrf52840_m2";
chosen {
zmk,battery = &vbatt;
};
vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
io-channels = <&adc 0>;
output-ohms = <1000000>;
full-ohms = <(1000000 + 1000000)>;
};
};

View File

@ -13,7 +13,7 @@ include:
- board: nice60
- board: xiao_ble//zmk
shield: hummingbird
- board: nrf52840_m2
- board: nrf52840_m2//zmk
shield: m60
- board: planck
- board: proton_c

View File

@ -0,0 +1,5 @@
# Copyright (c) 2026 The ZMK Contributors
# SPDX-License-Identifier: Apache-2.0
config BOARD_NRF52840_M2
select SOC_NRF52840_QIAA

View File

@ -0,0 +1,7 @@
# Copyright (c) 2026 The ZMK Contributors
# SPDX-License-Identifier: MIT
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)

View File

@ -0,0 +1,5 @@
board:
name: nrf52840_m2
vendor: makerdiary
socs:
- name: nrf52840

View File

@ -6,7 +6,6 @@
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <common/nordic/nrf52840_uf2_boot_mode.dtsi>
/ {
model = "Makerdiary nRF52840 M.2 module";
@ -16,7 +15,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,battery = &vbatt;
};
leds {
@ -31,14 +29,6 @@
gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
};
};
vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
io-channels = <&adc 0>;
output-ohms = <1000000>;
full-ohms = <(1000000 + 1000000)>;
};
};
&adc {

View File

@ -0,0 +1,15 @@
identifier: nrf52840_m2
name: Makerdiary nRF52840 M.2 module
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog

View File

@ -0,0 +1,12 @@
# Copyright (c) 2026 The ZMK Contributors
# SPDX-License-Identifier: MIT
# Enable MPU
CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_BUILD_OUTPUT_UF2=y

View File

@ -0,0 +1,9 @@
#
# Copyright (c) 2026 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller
# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")