-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Supports selecting from several possible charge currents Co-authored-by: Pete Johanson <peter@peterjohanson.com>
- Loading branch information
1 parent
944f931
commit f2e0642
Showing
11 changed files
with
363 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands | ||
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py | ||
-c | ||
-b 0x26000 | ||
-f 0xADA52840 | ||
-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2 | ||
${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin | ||
) | ||
|
||
if(CONFIG_PINMUX) | ||
zephyr_library() | ||
zephyr_library_sources(pinmux.c) | ||
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
config BOARD_ENABLE_DCDC | ||
bool "Enable DCDC mode" | ||
select SOC_DCDC_NRF52X | ||
default y | ||
depends on (BOARD_MIKOTO_520) | ||
|
||
choice BOARD_MIKOTO_CHARGER_CURRENT | ||
prompt "Charge current to supply to attached batteries" | ||
depends on (BOARD_MIKOTO_520) | ||
|
||
config BOARD_MIKOTO_CHARGER_CURRENT_40MA | ||
bool "40mA charge current, for battery capacity 40mAh or higher" | ||
|
||
config BOARD_MIKOTO_CHARGER_CURRENT_100MA | ||
bool "100mA charge current, for battery capacity 100mAh or higher" | ||
|
||
config BOARD_MIKOTO_CHARGER_CURRENT_150MA | ||
bool "150mA charge current, for battery capacity 150mAh or higher" | ||
|
||
config BOARD_MIKOTO_CHARGER_CURRENT_250MA | ||
bool "250mA charge current, for battery capacity 250mAh or higher" | ||
|
||
config BOARD_MIKOTO_CHARGER_CURRENT_350MA | ||
bool "350mA charge current, for battery capacity 350mAh or higher" | ||
|
||
config BOARD_MIKOTO_CHARGER_CURRENT_NONE | ||
bool "Disable charge current" | ||
|
||
endchoice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# mikoto board configuration | ||
|
||
# Copyright (c) 2020 The ZMK Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
config BOARD_MIKOTO_520 | ||
bool "mikoto_520" | ||
depends on SOC_NRF52840_QIAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Electronut Labs Papyr board configuration | ||
|
||
# Copyright (c) 2020 The ZMK Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
if BOARD_MIKOTO_520 | ||
|
||
config BOARD | ||
default "mikoto" | ||
|
||
if USB | ||
|
||
config USB_NRFX | ||
default y | ||
|
||
config USB_DEVICE_STACK | ||
default y | ||
|
||
endif # USB | ||
|
||
config BT_CTLR | ||
default BT | ||
|
||
config ZMK_BLE | ||
default y | ||
|
||
config ZMK_USB | ||
default y | ||
|
||
config PINMUX | ||
default y | ||
|
||
choice BOARD_MIKOTO_CHARGER_CURRENT | ||
default BOARD_MIKOTO_CHARGER_CURRENT_100MA | ||
endchoice | ||
|
||
config ZMK_BATTERY_VOLTAGE_DIVIDER | ||
default y | ||
|
||
endif # BOARD_MIKOTO_520 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 0 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 0 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 {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") | ||
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Copyright (c) 2020 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
/dts-v1/; | ||
#include <nordic/nrf52840_qiaa.dtsi> | ||
#include "arduino_pro_micro_pins.dtsi" | ||
|
||
/ { | ||
model = "mikoto"; | ||
compatible = "zhiayang,mikoto"; | ||
|
||
chosen { | ||
zephyr,code-partition = &code_partition; | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
}; | ||
|
||
leds { | ||
compatible = "gpio-leds"; | ||
blue_led: led_0 { | ||
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; | ||
label = "Blue LED"; | ||
}; | ||
}; | ||
|
||
ext-power { | ||
compatible = "zmk,ext-power-generic"; | ||
label = "EXT_POWER"; | ||
control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; | ||
}; | ||
|
||
vbatt { | ||
compatible = "zmk,battery-voltage-divider"; | ||
label = "BATTERY"; | ||
io-channels = <&adc 2>; | ||
output-ohms = <10000000>; | ||
full-ohms = <(10000000 + 4000000)>; | ||
}; | ||
}; | ||
|
||
&adc { | ||
status = "okay"; | ||
}; | ||
|
||
&gpiote { | ||
status = "okay"; | ||
}; | ||
|
||
&gpio0 { | ||
status = "okay"; | ||
}; | ||
|
||
&gpio1 { | ||
status = "okay"; | ||
}; | ||
|
||
&i2c0 { | ||
compatible = "nordic,nrf-twi"; | ||
sda-pin = <17>; | ||
scl-pin = <20>; | ||
}; | ||
|
||
&uart0 { | ||
compatible = "nordic,nrf-uarte"; | ||
tx-pin = <8>; | ||
rx-pin = <4>; | ||
}; | ||
|
||
&usbd { | ||
status = "okay"; | ||
}; | ||
|
||
|
||
&flash0 { | ||
/* | ||
* For more information, see: | ||
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html | ||
*/ | ||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
sd_partition: partition@0 { | ||
label = "softdevice"; | ||
reg = <0x00000000 0x00026000>; | ||
}; | ||
code_partition: partition@26000 { | ||
label = "code_partition"; | ||
reg = <0x00026000 0x000c6000>; | ||
}; | ||
|
||
/* | ||
* The flash starting at 0x000ec000 and ending at | ||
* 0x000f3fff is reserved for use by the application. | ||
*/ | ||
|
||
/* | ||
* Storage partition will be used by FCB/LittleFS/NVS | ||
* if enabled. | ||
*/ | ||
storage_partition: partition@ec000 { | ||
label = "storage"; | ||
reg = <0x000ec000 0x00008000>; | ||
}; | ||
|
||
boot_partition: partition@f4000 { | ||
label = "adafruit_boot"; | ||
reg = <0x000f4000 0x0000c000>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
identifier: mikoto_520 | ||
name: mikoto_520 | ||
type: mcu | ||
arch: arm | ||
toolchain: | ||
- zephyr | ||
- gnuarmemb | ||
- xtools | ||
supported: | ||
- adc | ||
- usb_device | ||
- ble | ||
- ieee802154 | ||
- pwm | ||
- watchdog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
file_format: "1" | ||
id: mikoto_520 | ||
name: Mikoto 5.20 | ||
type: board | ||
arch: arm | ||
outputs: | ||
- usb | ||
- ble | ||
url: https://github.com/zhiayang/mikoto | ||
exposes: [pro_micro] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
CONFIG_SOC_SERIES_NRF52X=y | ||
CONFIG_SOC_NRF52840_QIAA=y | ||
CONFIG_BOARD_MIKOTO_520=y | ||
|
||
# Enable MPU | ||
CONFIG_ARM_MPU=y | ||
|
||
# enable GPIO | ||
CONFIG_GPIO=y | ||
|
||
CONFIG_USE_DT_CODE_PARTITION=y | ||
|
||
CONFIG_MPU_ALLOW_FLASH_WRITE=y | ||
CONFIG_NVS=y | ||
CONFIG_SETTINGS_NVS=y | ||
CONFIG_FLASH=y | ||
CONFIG_FLASH_PAGE_LAYOUT=y | ||
CONFIG_FLASH_MAP=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2020 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <kernel.h> | ||
#include <device.h> | ||
#include <init.h> | ||
#include <drivers/gpio.h> | ||
#include <sys/sys_io.h> | ||
#include <devicetree.h> | ||
|
||
static int pinmux_mikoto_init(const struct device *port) { | ||
ARG_UNUSED(port); | ||
|
||
#if CONFIG_BOARD_MIKOTO_520 | ||
const struct device *p0 = device_get_binding("GPIO_0"); | ||
const struct device *p1 = device_get_binding("GPIO_1"); | ||
#if CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_40MA | ||
gpio_pin_configure(p0, 26, GPIO_INPUT | GPIO_PULL_DOWN); | ||
gpio_pin_configure(p1, 15, GPIO_INPUT); | ||
#elif CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_100MA | ||
gpio_pin_configure(p0, 26, GPIO_OUTPUT); | ||
gpio_pin_set(p0, 26, 0); | ||
gpio_pin_configure(p1, 15, GPIO_INPUT); | ||
#elif CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_150MA | ||
gpio_pin_configure(p0, 26, GPIO_OUTPUT); | ||
gpio_pin_set(p0, 26, 0); | ||
gpio_pin_configure(p1, 15, GPIO_INPUT | GPIO_PULL_DOWN); | ||
#elif CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_250MA | ||
gpio_pin_configure(p0, 26, GPIO_INPUT); | ||
gpio_pin_configure(p1, 15, GPIO_OUTPUT); | ||
gpio_pin_set(p1, 15, 0); | ||
#elif CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_350MA | ||
gpio_pin_configure(p0, 26, GPIO_OUTPUT); | ||
gpio_pin_set(p0, 26, 0); | ||
gpio_pin_configure(p1, 15, GPIO_OUTPUT); | ||
gpio_pin_set(p1, 15, 0); | ||
#elif CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_NONE | ||
gpio_pin_configure(p0, 26, GPIO_INPUT); | ||
gpio_pin_configure(p1, 15, GPIO_INPUT); | ||
#endif | ||
#endif | ||
return 0; | ||
} | ||
|
||
SYS_INIT(pinmux_mikoto_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); |
f2e0642
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,I use the mikoto board and flash the mikoto_520 ,but my battery cant be charged.
How to define the current charger? could you give me some advices?thank you