config battery charger

This commit is contained in:
mrninhvn 2021-10-12 21:41:01 +07:00
parent f2afdb393c
commit 44bec0699c
9 changed files with 57 additions and 44 deletions

View file

@ -2,9 +2,9 @@ config BOARD_ENABLE_DCDC
bool "Enable DCDC mode" bool "Enable DCDC mode"
select SOC_DCDC_NRF52X select SOC_DCDC_NRF52X
default y default y
depends on (BOARD_MIKOTO_517) depends on (BOARD_MIKOTO_520)
config BOARD_MIKOTO_CHARGER config BOARD_MIKOTO_CHARGER
bool "Enable battery charger" bool "Enable battery charger"
default y default y
depends on (BOARD_MIKOTO_517) depends on (BOARD_MIKOTO_520)

View file

@ -3,6 +3,6 @@
# Copyright (c) 2020 The ZMK Contributors # Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
config BOARD_MIKOTO_517 config BOARD_MIKOTO_520
bool "mikoto_517" bool "mikoto_520"
depends on SOC_NRF52840_QIAA depends on SOC_NRF52840_QIAA

View file

@ -3,7 +3,7 @@
# Copyright (c) 2020 The ZMK Contributors # Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
if BOARD_MIKOTO_517 if BOARD_MIKOTO_520
config BOARD config BOARD
default "mikoto" default "mikoto"
@ -36,4 +36,4 @@ config BOARD_MIKOTO_CHARGER
config ZMK_BATTERY_VOLTAGE_DIVIDER config ZMK_BATTERY_VOLTAGE_DIVIDER
default y default y
endif # BOARD_MIKOTO_517 endif # BOARD_MIKOTO_520

View file

@ -12,24 +12,24 @@
gpio-map-mask = <0xffffffff 0xffffffc0>; gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>; gpio-map-pass-thru = <0 0x3f>;
gpio-map gpio-map
= <0 0 &gpio0 8 0> /* D0 */ = <0 0 &gpio0 4 0> /* D0 */
, <1 0 &gpio0 6 0> /* D1 */ , <1 0 &gpio0 8 0> /* D1 */
, <2 0 &gpio0 15 0> /* D2 */ , <2 0 &gpio0 17 0> /* D2 */
, <3 0 &gpio0 17 0> /* D3 */ , <3 0 &gpio0 20 0> /* D3 */
, <4 0 &gpio0 20 0> /* D4/A6 */ , <4 0 &gpio0 22 0> /* D4/A6 */
, <5 0 &gpio0 13 0> /* D5 */ , <5 0 &gpio0 24 0> /* D5 */
, <6 0 &gpio0 24 0> /* D6/A7 */ , <6 0 &gpio1 0 0> /* D6/A7 */
, <7 0 &gpio0 9 0> /* D7 */ , <7 0 &gpio1 2 0> /* D7 */
, <8 0 &gpio0 10 0> /* D8/A8 */ , <8 0 &gpio1 4 0> /* D8/A8 */
, <9 0 &gpio1 6 0> /* D9/A9 */ , <9 0 &gpio1 6 0> /* D9/A9 */
, <10 0 &gpio1 11 0> /* D10/A10 */ , <10 0 &gpio0 9 0> /* D10/A10 */
, <16 0 &gpio0 28 0> /* D16 */ , <16 0 &gpio0 10 0> /* D16 */
, <14 0 &gpio0 3 0> /* D14 */ , <14 0 &gpio1 13 0> /* D14 */
, <15 0 &gpio1 13 0> /* D15 */ , <15 0 &gpio0 2 0> /* D15 */
, <18 0 &gpio0 2 0> /* D18/A0 */ , <18 0 &gpio0 29 0> /* D18/A0 */
, <19 0 &gpio0 29 0> /* D19/A1 */ , <19 0 &gpio0 31 0> /* D19/A1 */
, <20 0 &gpio0 31 0> /* D20/A2 */ , <20 0 &gpio0 25 0> /* D20/A2 */
, <21 0 &gpio0 30 0> /* D21/A3 */ , <21 0 &gpio0 11 0> /* D21/A3 */
; ;
}; };
@ -39,15 +39,15 @@
gpio-map-mask = <0xffffffff 0xffffffc0>; gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>; gpio-map-pass-thru = <0 0x3f>;
gpio-map gpio-map
= <0 0 &gpio0 2 0> /* D18/A0 */ = <0 0 &gpio0 29 0> /* D18/A0 */
, <1 0 &gpio0 29 0> /* D19/A1 */ , <1 0 &gpio0 31 0> /* D19/A1 */
, <2 0 &gpio0 31 0> /* D20/A2 */ , <2 0 &gpio0 25 0> /* D20/A2 */
, <3 0 &gpio0 30 0> /* D21/A3 */ , <3 0 &gpio0 11 0> /* D21/A3 */
, <6 0 &gpio0 20 0> /* D4/A6 */ , <6 0 &gpio0 22 0> /* D4/A6 */
, <7 0 &gpio0 24 0> /* D6/A7 */ , <7 0 &gpio1 0 0> /* D6/A7 */
, <8 0 &gpio0 10 0> /* D8/A8 */ , <8 0 &gpio1 4 0> /* D8/A8 */
, <9 0 &gpio1 6 0> /* D9/A9 */ , <9 0 &gpio1 6 0> /* D9/A9 */
, <10 0 &gpio1 11 0> /* D10/A10 */ , <10 0 &gpio0 9 0> /* D10/A10 */
; ;
}; };
}; };

View file

@ -21,7 +21,7 @@
leds { leds {
compatible = "gpio-leds"; compatible = "gpio-leds";
blue_led: led_0 { blue_led: led_0 {
gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
label = "Blue LED"; label = "Blue LED";
}; };
}; };
@ -29,15 +29,15 @@
ext-power { ext-power {
compatible = "zmk,ext-power-generic"; compatible = "zmk,ext-power-generic";
label = "EXT_POWER"; label = "EXT_POWER";
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
}; };
vbatt { vbatt {
compatible = "zmk,battery-voltage-divider"; compatible = "zmk,battery-voltage-divider";
label = "BATTERY"; label = "BATTERY";
io-channels = <&adc 2>; io-channels = <&adc 2>;
output-ohms = <2000000>; output-ohms = <10000000>;
full-ohms = <(2000000 + 820000)>; full-ohms = <(10000000 + 4000000)>;
}; };
}; };

View file

@ -1,5 +1,5 @@
identifier: mikoto_517 identifier: mikoto_520
name: mikoto_517 name: mikoto_520
type: mcu type: mcu
arch: arm arch: arm
toolchain: toolchain:

View file

@ -1,6 +1,6 @@
file_format: "1" file_format: "1"
id: mikoto_517 id: mikoto_520
name: Mikoto 5.17 name: Mikoto 5.20
type: board type: board
arch: arm arch: arm
outputs: outputs:

View file

@ -2,7 +2,7 @@
CONFIG_SOC_SERIES_NRF52X=y CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_MIKOTO_517=y CONFIG_BOARD_MIKOTO_520=y
# Enable MPU # Enable MPU
CONFIG_ARM_MPU=y CONFIG_ARM_MPU=y

View file

@ -14,13 +14,26 @@
static int pinmux_mikoto_init(const struct device *port) { static int pinmux_mikoto_init(const struct device *port) {
ARG_UNUSED(port); ARG_UNUSED(port);
#if CONFIG_BOARD_MIKOTO_517 #if CONFIG_BOARD_MIKOTO_520
const struct device *p0 = device_get_binding("GPIO_0"); const struct device *p0 = device_get_binding("GPIO_0");
const struct device *p1 = device_get_binding("GPIO_1");
#if CONFIG_BOARD_MIKOTO_CHARGER #if CONFIG_BOARD_MIKOTO_CHARGER
gpio_pin_configure(p0, 5, GPIO_OUTPUT); // 100mA
gpio_pin_set(p0, 5, 0); gpio_pin_configure(p0, 26, GPIO_OUTPUT);
gpio_pin_set(p0, 26, 0);
gpio_pin_configure(p1, 15, GPIO_INPUT);
// 250mA
// gpio_pin_configure(p0, 26, GPIO_INPUT);
// gpio_pin_configure(p1, 15, GPIO_OUTPUT);
// gpio_pin_set(p1, 15, 0);
// 250mA
// 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);
#else #else
gpio_pin_configure(p0, 5, GPIO_INPUT); gpio_pin_configure(p0, 26, GPIO_INPUT);
gpio_pin_configure(p1, 15, GPIO_INPUT);
#endif #endif
#endif #endif
return 0; return 0;