refactor(battery): Auto enable battery drivers

CONFIG_ZMK_BATTERY_NRF_VDDH and CONFIG_ZMK_BATTERY_VOLTAGE_DIVIDER are
now automatically enabled if a DT node with the matching "compatible"
property is present and enabled, so they no longer need to be manually
set for each board.
This commit is contained in:
Joel Spadin 2022-04-18 21:02:20 -05:00 committed by Pete Johanson
parent 6d6efa32f5
commit 11ab52582c
9 changed files with 7 additions and 35 deletions

View file

@ -24,7 +24,4 @@ config ZMK_BLE
config ZMK_USB config ZMK_USB
default y default y
config ZMK_BATTERY_VOLTAGE_DIVIDER
default y
endif # BOARD_BLUEMICRO840_V1 endif # BOARD_BLUEMICRO840_V1

View file

@ -25,9 +25,6 @@ config ZMK_BLE
config ZMK_USB config ZMK_USB
default y default y
config ZMK_BATTERY_VOLTAGE_DIVIDER
default y
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "BT60" default "BT60"

View file

@ -34,7 +34,4 @@ choice BOARD_MIKOTO_CHARGER_CURRENT
default BOARD_MIKOTO_CHARGER_CURRENT_100MA default BOARD_MIKOTO_CHARGER_CURRENT_100MA
endchoice endchoice
config ZMK_BATTERY_VOLTAGE_DIVIDER
default y
endif # BOARD_MIKOTO_520 endif # BOARD_MIKOTO_520

View file

@ -22,7 +22,4 @@ config ZMK_BLE
config ZMK_USB config ZMK_USB
default y default y
config ZMK_BATTERY_VOLTAGE_DIVIDER
default y
endif # BOARD_NICE60 endif # BOARD_NICE60

View file

@ -23,17 +23,3 @@ config ZMK_USB
default y default y
endif # BOARD_NICE_NANO || BOARD_NICE_NANO_V2 endif # BOARD_NICE_NANO || BOARD_NICE_NANO_V2
if BOARD_NICE_NANO
config ZMK_BATTERY_VOLTAGE_DIVIDER
default y
endif # BOARD_NICE_NANO
if BOARD_NICE_NANO_V2
config ZMK_BATTERY_NRF_VDDH
default y
endif # BOARD_NICE_NANO_V2

View file

@ -32,9 +32,6 @@ if BOARD_NRFMICRO_13
config BOARD_NRFMICRO_CHARGER config BOARD_NRFMICRO_CHARGER
default y default y
config ZMK_BATTERY_VOLTAGE_DIVIDER
default y
endif # BOARD_NRFMICRO_13 endif # BOARD_NRFMICRO_13
endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13

View file

@ -25,7 +25,4 @@ config ZMK_BLE
config ZMK_USB config ZMK_USB
default y default y
config ZMK_BATTERY_VOLTAGE_DIVIDER
default y
endif # BOARD_S40NC endif # BOARD_S40NC

View file

@ -3,7 +3,6 @@ CONFIG_CONSOLE=n
CONFIG_SERIAL=n CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n CONFIG_UART_CONSOLE=n
CONFIG_UART_INTERRUPT_DRIVEN=n CONFIG_UART_INTERRUPT_DRIVEN=n
CONFIG_ZMK_BATTERY_VOLTAGE_DIVIDER=y
CONFIG_ZMK_USB=y CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y CONFIG_ZMK_BLE=y

View file

@ -1,20 +1,25 @@
# Copyright (c) 2020-2021 The ZMK Contributors # Copyright (c) 2020-2021 The ZMK Contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
DT_COMPAT_ZMK_BATTERY_NRF_VDDH := zmk,battery-nrf-vddh
DT_COMPAT_ZMK_BATTERY_VOLTAGE_DIVIDER := zmk,battery-voltage-divider
config ZMK_BATTERY config ZMK_BATTERY
bool "ZMK battery monitoring" bool "ZMK battery monitoring"
help help
Enable battery monitoring Enable battery monitoring
config ZMK_BATTERY_NRF_VDDH config ZMK_BATTERY_NRF_VDDH
bool "ZMK nRF VDDH battery monitoring" bool
default $(dt_compat_enabled,$(DT_COMPAT_ZMK_BATTERY_NRF_VDDH))
select ADC select ADC
select ZMK_BATTERY select ZMK_BATTERY
help help
Enable ZMK nRF VDDH voltage driver for battery monitoring. Enable ZMK nRF VDDH voltage driver for battery monitoring.
config ZMK_BATTERY_VOLTAGE_DIVIDER config ZMK_BATTERY_VOLTAGE_DIVIDER
bool "ZMK battery voltage divider" bool
default $(dt_compat_enabled,$(DT_COMPAT_ZMK_BATTERY_VOLTAGE_DIVIDER))
select ADC select ADC
select ZMK_BATTERY select ZMK_BATTERY
help help