aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoryuki <[email protected]>2024-12-05 15:02:58 +0800
committerGitHub <[email protected]>2024-12-05 02:02:58 -0500
commitb26058b6c7c83f8d1f095d2f9c6c3998b391a61b (patch)
tree8ca728ebcffd602e2dd2cdc96b49e5427a1fc74c
parent40925d48e67b3eeaeb3e848a2287ed628de9f674 (diff)
downloadzmk-b26058b6c7c83f8d1f095d2f9c6c3998b391a61b.tar.gz
zmk-b26058b6c7c83f8d1f095d2f9c6c3998b391a61b.zip
feat(boards): Update for mikoto board definition (#1946)
* Set default revision to 5.20 * update mikoto board defs * add revision info to mikoto.zmk.yml * use zephyr aliases to handle mikoto_520 * enable pull-ups for on-board i2c
-rw-r--r--app/CMakeLists.txt1
-rw-r--r--app/boards/aliases.cmake2
-rw-r--r--app/boards/arm/mikoto/Kconfig8
-rw-r--r--app/boards/arm/mikoto/Kconfig.board4
-rw-r--r--app/boards/arm/mikoto/Kconfig.defconfig4
-rw-r--r--app/boards/arm/mikoto/arduino_pro_micro_pins_v5.dtsi (renamed from app/boards/arm/mikoto/arduino_pro_micro_pins.dtsi)0
-rw-r--r--app/boards/arm/mikoto/arduino_pro_micro_pins_v6.dtsi59
-rw-r--r--app/boards/arm/mikoto/mikoto-pinctrl.dtsi (renamed from app/boards/arm/mikoto/mikoto_520-pinctrl.dtsi)6
-rw-r--r--app/boards/arm/mikoto/mikoto.dts (renamed from app/boards/arm/mikoto/mikoto_520.dts)2
-rw-r--r--app/boards/arm/mikoto/mikoto.yaml (renamed from app/boards/arm/mikoto/mikoto_520.yaml)4
-rw-r--r--app/boards/arm/mikoto/mikoto.zmk.yml (renamed from app/boards/arm/mikoto/mikoto_520.zmk.yml)10
-rw-r--r--app/boards/arm/mikoto/mikoto_5_20_0.overlay8
-rw-r--r--app/boards/arm/mikoto/mikoto_6_1_0.overlay8
-rw-r--r--app/boards/arm/mikoto/mikoto_7_2_0.conf2
-rw-r--r--app/boards/arm/mikoto/mikoto_7_2_0.overlay47
-rw-r--r--app/boards/arm/mikoto/mikoto_defconfig (renamed from app/boards/arm/mikoto/mikoto_520_defconfig)3
-rw-r--r--app/boards/arm/mikoto/pinmux.c2
-rw-r--r--app/boards/arm/mikoto/revision.cmake7
-rw-r--r--app/boards/shields/nice_view_adapter/boards/mikoto.overlay (renamed from app/boards/shields/nice_view_adapter/boards/mikoto_520.overlay)0
19 files changed, 157 insertions, 20 deletions
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index fd4b7ab551..75925b7e0d 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.13.1)
set(CONFIG_APPLICATION_DEFINED_SYSCALL true)
+set(ZEPHYR_BOARD_ALIASES "boards/aliases.cmake")
set(ZEPHYR_EXTRA_MODULES "${ZMK_EXTRA_MODULES};${CMAKE_CURRENT_SOURCE_DIR}/module;${CMAKE_CURRENT_SOURCE_DIR}/keymap-module")
# Find Zephyr. This also loads Zephyr's build system.
diff --git a/app/boards/aliases.cmake b/app/boards/aliases.cmake
new file mode 100644
index 0000000000..d0a4d81d88
--- /dev/null
+++ b/app/boards/aliases.cmake
@@ -0,0 +1,2 @@
+# defines board aliases for shorter names (or for renaming boards)
+set(mikoto_520_BOARD_ALIAS "mikoto")
diff --git a/app/boards/arm/mikoto/Kconfig b/app/boards/arm/mikoto/Kconfig
index fab2218c04..616d63a5dd 100644
--- a/app/boards/arm/mikoto/Kconfig
+++ b/app/boards/arm/mikoto/Kconfig
@@ -2,17 +2,17 @@ config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
- depends on (BOARD_MIKOTO_520)
+ depends on (BOARD_MIKOTO)
config BOARD_ENABLE_DCDC_HV
bool "High voltage DCDC converter"
select SOC_DCDC_NRF52X_HV
default y
- depends on (BOARD_MIKOTO_520)
+ depends on (BOARD_MIKOTO)
choice BOARD_MIKOTO_CHARGER_CURRENT
prompt "Charge current to supply to attached batteries"
- depends on (BOARD_MIKOTO_520)
+ depends on (BOARD_MIKOTO)
config BOARD_MIKOTO_CHARGER_CURRENT_40MA
bool "40mA charge current, for battery capacity 40mAh or higher"
@@ -32,4 +32,4 @@ config BOARD_MIKOTO_CHARGER_CURRENT_350MA
config BOARD_MIKOTO_CHARGER_CURRENT_NONE
bool "Disable charge current"
-endchoice \ No newline at end of file
+endchoice
diff --git a/app/boards/arm/mikoto/Kconfig.board b/app/boards/arm/mikoto/Kconfig.board
index a872fa1fa0..b51dce8adb 100644
--- a/app/boards/arm/mikoto/Kconfig.board
+++ b/app/boards/arm/mikoto/Kconfig.board
@@ -3,6 +3,6 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
-config BOARD_MIKOTO_520
- bool "mikoto_520"
+config BOARD_MIKOTO
+ bool "mikoto"
depends on SOC_NRF52840_QIAA
diff --git a/app/boards/arm/mikoto/Kconfig.defconfig b/app/boards/arm/mikoto/Kconfig.defconfig
index 5702c6de34..0710f6fde8 100644
--- a/app/boards/arm/mikoto/Kconfig.defconfig
+++ b/app/boards/arm/mikoto/Kconfig.defconfig
@@ -3,7 +3,7 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
-if BOARD_MIKOTO_520
+if BOARD_MIKOTO
config BOARD
default "mikoto"
@@ -25,4 +25,4 @@ choice BOARD_MIKOTO_CHARGER_CURRENT
default BOARD_MIKOTO_CHARGER_CURRENT_100MA
endchoice
-endif # BOARD_MIKOTO_520
+endif # BOARD_MIKOTO
diff --git a/app/boards/arm/mikoto/arduino_pro_micro_pins.dtsi b/app/boards/arm/mikoto/arduino_pro_micro_pins_v5.dtsi
index b2e2d6a3cf..b2e2d6a3cf 100644
--- a/app/boards/arm/mikoto/arduino_pro_micro_pins.dtsi
+++ b/app/boards/arm/mikoto/arduino_pro_micro_pins_v5.dtsi
diff --git a/app/boards/arm/mikoto/arduino_pro_micro_pins_v6.dtsi b/app/boards/arm/mikoto/arduino_pro_micro_pins_v6.dtsi
new file mode 100644
index 0000000000..79d8b1558b
--- /dev/null
+++ b/app/boards/arm/mikoto/arduino_pro_micro_pins_v6.dtsi
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+
+/ {
+ pro_micro: connector {
+ compatible = "arduino-pro-micro";
+ #gpio-cells = <2>;
+ gpio-map-mask = <0xffffffff 0xffffffc0>;
+ gpio-map-pass-thru = <0 0x3f>;
+ gpio-map
+ = <0 0 &gpio0 4 0> /* D0 */
+ , <1 0 &gpio0 8 0> /* D1 */
+ , <2 0 &gpio0 17 0> /* D2 */
+ , <3 0 &gpio0 20 0> /* D3 */
+ , <4 0 &gpio0 22 0> /* D4/A6 */
+ , <5 0 &gpio0 24 0> /* D5 */
+ , <6 0 &gpio1 8 0> /* D6/A7 */
+ , <7 0 &gpio1 2 0> /* D7 */
+ , <8 0 &gpio1 4 0> /* D8/A8 */
+ , <9 0 &gpio1 6 0> /* D9/A9 */
+ , <10 0 &gpio0 9 0> /* D10/A10 */
+ , <16 0 &gpio0 10 0> /* D16 */
+ , <14 0 &gpio1 13 0> /* D14 */
+ , <15 0 &gpio0 2 0> /* D15 */
+ , <18 0 &gpio0 29 0> /* D18/A0 */
+ , <19 0 &gpio0 31 0> /* D19/A1 */
+ , <20 0 &gpio0 25 0> /* D20/A2 */
+ , <21 0 &gpio0 11 0> /* D21/A3 */
+ ;
+ };
+
+ pro_micro_a: connector_a {
+ compatible = "arduino-pro-micro";
+ #gpio-cells = <2>;
+ gpio-map-mask = <0xffffffff 0xffffffc0>;
+ gpio-map-pass-thru = <0 0x3f>;
+ gpio-map
+ = <0 0 &gpio0 29 0> /* D18/A0 */
+ , <1 0 &gpio0 31 0> /* D19/A1 */
+ , <2 0 &gpio0 25 0> /* D20/A2 */
+ , <3 0 &gpio0 11 0> /* D21/A3 */
+ , <6 0 &gpio0 22 0> /* D4/A6 */
+ , <7 0 &gpio1 8 0> /* D6/A7 */
+ , <8 0 &gpio1 4 0> /* D8/A8 */
+ , <9 0 &gpio1 6 0> /* D9/A9 */
+ , <10 0 &gpio0 9 0> /* D10/A10 */
+ ;
+ };
+};
+
+
+pro_micro_d: &pro_micro {};
+pro_micro_i2c: &i2c0 {};
+pro_micro_spi: &spi0 {};
+pro_micro_serial: &uart0 {};
diff --git a/app/boards/arm/mikoto/mikoto_520-pinctrl.dtsi b/app/boards/arm/mikoto/mikoto-pinctrl.dtsi
index 8cd1e0afc1..1c85c203ad 100644
--- a/app/boards/arm/mikoto/mikoto_520-pinctrl.dtsi
+++ b/app/boards/arm/mikoto/mikoto-pinctrl.dtsi
@@ -17,7 +17,7 @@
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_RX, 0, 4)>,
- <NRF_PSEL(UART_TX, 0, 8)>;
+ <NRF_PSEL(UART_TX, 0, 8)>;
low-power-enable;
};
};
@@ -25,14 +25,14 @@
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 17)>,
- <NRF_PSEL(TWIM_SCL, 0, 20)>;
+ <NRF_PSEL(TWIM_SCL, 0, 20)>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 17)>,
- <NRF_PSEL(TWIM_SCL, 0, 20)>;
+ <NRF_PSEL(TWIM_SCL, 0, 20)>;
low-power-enable;
};
};
diff --git a/app/boards/arm/mikoto/mikoto_520.dts b/app/boards/arm/mikoto/mikoto.dts
index 3ea48cd991..b8dca95030 100644
--- a/app/boards/arm/mikoto/mikoto_520.dts
+++ b/app/boards/arm/mikoto/mikoto.dts
@@ -6,8 +6,6 @@
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
-#include "arduino_pro_micro_pins.dtsi"
-#include "mikoto_520-pinctrl.dtsi"
/ {
model = "mikoto";
diff --git a/app/boards/arm/mikoto/mikoto_520.yaml b/app/boards/arm/mikoto/mikoto.yaml
index 8d9f49ae85..7410471eb5 100644
--- a/app/boards/arm/mikoto/mikoto_520.yaml
+++ b/app/boards/arm/mikoto/mikoto.yaml
@@ -1,5 +1,5 @@
-identifier: mikoto_520
-name: mikoto_520
+identifier: mikoto
+name: mikoto
type: mcu
arch: arm
toolchain:
diff --git a/app/boards/arm/mikoto/mikoto_520.zmk.yml b/app/boards/arm/mikoto/mikoto.zmk.yml
index 91dcc9e09a..6e073410fa 100644
--- a/app/boards/arm/mikoto/mikoto_520.zmk.yml
+++ b/app/boards/arm/mikoto/mikoto.zmk.yml
@@ -1,6 +1,6 @@
file_format: "1"
-id: mikoto_520
-name: Mikoto 5.20
+id: mikoto
+name: Mikoto
type: board
arch: arm
outputs:
@@ -8,3 +8,9 @@ outputs:
- ble
url: https://github.com/zhiayang/mikoto
exposes: [pro_micro]
+revisions:
+ - "5.20"
+ - "6.1"
+ - "6.3"
+ - "7.2"
+default_revision: "5.20"
diff --git a/app/boards/arm/mikoto/mikoto_5_20_0.overlay b/app/boards/arm/mikoto/mikoto_5_20_0.overlay
new file mode 100644
index 0000000000..f9e744ea37
--- /dev/null
+++ b/app/boards/arm/mikoto/mikoto_5_20_0.overlay
@@ -0,0 +1,8 @@
+/*
+ * Copyright (c) 2023 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "mikoto-pinctrl.dtsi"
+#include "arduino_pro_micro_pins_v5.dtsi"
diff --git a/app/boards/arm/mikoto/mikoto_6_1_0.overlay b/app/boards/arm/mikoto/mikoto_6_1_0.overlay
new file mode 100644
index 0000000000..80466fd258
--- /dev/null
+++ b/app/boards/arm/mikoto/mikoto_6_1_0.overlay
@@ -0,0 +1,8 @@
+/*
+ * Copyright (c) 2023 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "mikoto-pinctrl.dtsi"
+#include "arduino_pro_micro_pins_v6.dtsi"
diff --git a/app/boards/arm/mikoto/mikoto_7_2_0.conf b/app/boards/arm/mikoto/mikoto_7_2_0.conf
new file mode 100644
index 0000000000..8bf928868c
--- /dev/null
+++ b/app/boards/arm/mikoto/mikoto_7_2_0.conf
@@ -0,0 +1,2 @@
+CONFIG_I2C=y
+CONFIG_ZMK_MAX17048=y
diff --git a/app/boards/arm/mikoto/mikoto_7_2_0.overlay b/app/boards/arm/mikoto/mikoto_7_2_0.overlay
new file mode 100644
index 0000000000..30c05510a8
--- /dev/null
+++ b/app/boards/arm/mikoto/mikoto_7_2_0.overlay
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2023 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "mikoto-pinctrl.dtsi"
+#include "arduino_pro_micro_pins_v6.dtsi"
+
+&pinctrl {
+ i2c1_default: i2c1_default {
+ group1 {
+ psels = <NRF_PSEL(TWIM_SDA, 0, 23)>,
+ <NRF_PSEL(TWIM_SCL, 0, 19)>;
+ bias-pull-up;
+ };
+ };
+
+ i2c1_sleep: i2c1_sleep {
+ group1 {
+ psels = <NRF_PSEL(TWIM_SDA, 0, 23)>,
+ <NRF_PSEL(TWIM_SCL, 0, 19)>;
+ low-power-enable;
+ bias-pull-up;
+ };
+ };
+};
+
+&i2c1 {
+ status = "okay";
+ compatible = "nordic,nrf-twi";
+ pinctrl-0 = <&i2c1_default>;
+ pinctrl-1 = <&i2c1_sleep>;
+ pinctrl-names = "default", "sleep";
+
+ builtin_fuel_gauge: max17048@36 {
+ compatible = "zmk,maxim-max17048";
+ status = "okay";
+ reg = <0x36>;
+ };
+};
+
+/ {
+ chosen {
+ zmk,battery = &builtin_fuel_gauge;
+ };
+};
diff --git a/app/boards/arm/mikoto/mikoto_520_defconfig b/app/boards/arm/mikoto/mikoto_defconfig
index 354fa56aa3..4b3bc7d975 100644
--- a/app/boards/arm/mikoto/mikoto_520_defconfig
+++ b/app/boards/arm/mikoto/mikoto_defconfig
@@ -2,11 +2,10 @@
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
-CONFIG_BOARD_MIKOTO_520=y
+CONFIG_BOARD_MIKOTO=y
# Enable MPU
CONFIG_ARM_MPU=y
-
CONFIG_PINCTRL=y
# enable GPIO
diff --git a/app/boards/arm/mikoto/pinmux.c b/app/boards/arm/mikoto/pinmux.c
index c34c2dc85b..a39014247c 100644
--- a/app/boards/arm/mikoto/pinmux.c
+++ b/app/boards/arm/mikoto/pinmux.c
@@ -13,7 +13,7 @@
static int pinmux_mikoto_init(void) {
-#if CONFIG_BOARD_MIKOTO_520
+#if CONFIG_BOARD_MIKOTO
const struct device *p0 = DEVICE_DT_GET(DT_NODELABEL(gpio0));
const struct device *p1 = DEVICE_DT_GET(DT_NODELABEL(gpio1));
#if CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_40MA
diff --git a/app/boards/arm/mikoto/revision.cmake b/app/boards/arm/mikoto/revision.cmake
new file mode 100644
index 0000000000..12fd4bd4da
--- /dev/null
+++ b/app/boards/arm/mikoto/revision.cmake
@@ -0,0 +1,7 @@
+board_check_revision(FORMAT MAJOR.MINOR.PATCH
+ DEFAULT_REVISION 5.20.0
+ VALID_REVISIONS
+ 5.20.0 # first public release
+ 6.1.0 6.3.0 # incompatible pinout change from v5+
+ 7.2.0 # addition of MAX17048; compatible pinout with v6+
+)
diff --git a/app/boards/shields/nice_view_adapter/boards/mikoto_520.overlay b/app/boards/shields/nice_view_adapter/boards/mikoto.overlay
index e00b599c61..e00b599c61 100644
--- a/app/boards/shields/nice_view_adapter/boards/mikoto_520.overlay
+++ b/app/boards/shields/nice_view_adapter/boards/mikoto.overlay