add charger current choice

This commit is contained in:
mrninhvn 2021-10-21 13:25:26 +07:00
parent eef00512d7
commit b0462e54b6
3 changed files with 34 additions and 18 deletions

View file

@ -4,7 +4,20 @@ config BOARD_ENABLE_DCDC
default y default y
depends on (BOARD_MIKOTO_520) depends on (BOARD_MIKOTO_520)
config BOARD_MIKOTO_CHARGER choice BOARD_MIKOTO_CHARGER_CURRENT
bool "Enable battery charger" prompt "Charge current to supply to attached batteries"
default y depends on (BOARD_MIKOTO_520)
depends on (BOARD_MIKOTO_520)
config BOARD_MIKOTO_CHARGER_CURRENT_100MA
bool "100mA charge current"
config BOARD_MIKOTO_CHARGER_CURRENT_250MA
bool "250mA charge current"
config BOARD_MIKOTO_CHARGER_CURRENT_350MA
bool "350mA charge current"
config BOARD_MIKOTO_CHARGER_CURRENT_NONE
bool "Disable charge current"
endchoice

View file

@ -30,8 +30,9 @@ config ZMK_USB
config PINMUX config PINMUX
default y default y
config BOARD_MIKOTO_CHARGER choice BOARD_MIKOTO_CHARGER_CURRENT
default y default BOARD_MIKOTO_CHARGER_CURRENT_100MA
endchoice
config ZMK_BATTERY_VOLTAGE_DIVIDER config ZMK_BATTERY_VOLTAGE_DIVIDER
default y default y

View file

@ -17,21 +17,23 @@ static int pinmux_mikoto_init(const struct device *port) {
#if CONFIG_BOARD_MIKOTO_520 #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"); const struct device *p1 = device_get_binding("GPIO_1");
#if CONFIG_BOARD_MIKOTO_CHARGER #if CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_100MA
// 100mA
gpio_pin_configure(p0, 26, GPIO_OUTPUT); gpio_pin_configure(p0, 26, GPIO_OUTPUT);
gpio_pin_set(p0, 26, 0); gpio_pin_set(p0, 26, 0);
gpio_pin_configure(p1, 15, GPIO_INPUT); gpio_pin_configure(p1, 15, GPIO_INPUT);
// 250mA #endif
// gpio_pin_configure(p0, 26, GPIO_INPUT); #if CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_250MA
// gpio_pin_configure(p1, 15, GPIO_OUTPUT); gpio_pin_configure(p0, 26, GPIO_INPUT);
// gpio_pin_set(p1, 15, 0); gpio_pin_configure(p1, 15, GPIO_OUTPUT);
// 250mA gpio_pin_set(p1, 15, 0);
// gpio_pin_configure(p0, 26, GPIO_OUTPUT); #endif
// gpio_pin_set(p0, 26, 0); #if CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_350MA
// gpio_pin_configure(p1, 15, GPIO_OUTPUT); gpio_pin_configure(p0, 26, GPIO_OUTPUT);
// gpio_pin_set(p1, 15, 0); gpio_pin_set(p0, 26, 0);
#else gpio_pin_configure(p1, 15, GPIO_OUTPUT);
gpio_pin_set(p1, 15, 0);
#endif
#if CONFIG_BOARD_MIKOTO_CHARGER_CURRENT_NONE
gpio_pin_configure(p0, 26, GPIO_INPUT); gpio_pin_configure(p0, 26, GPIO_INPUT);
gpio_pin_configure(p1, 15, GPIO_INPUT); gpio_pin_configure(p1, 15, GPIO_INPUT);
#endif #endif