feat(battery)!: Add chosen node for battery

battery.c now uses the zmk,battery chosen node to select a battery
sensor. Using the node labeled "BATTERY" is maintained for backwards
compatibility but is now deprecated. Custom boards should switch to
using the chosen node.

# Conflicts:
#	app/boards/arm/bluemicro840/bluemicro840_v1.dts
#	app/boards/arm/nice60/nice60.dts
#	app/boards/arm/nrfmicro/nrfmicro_13.dts

# Conflicts:
#	app/boards/arm/bluemicro840/bluemicro840_v1.dts
This commit is contained in:
Joel Spadin
2021-07-17 17:49:37 -05:00
committed by Pete Johanson
parent d08463e483
commit 388e345c28
10 changed files with 40 additions and 12 deletions

View File

@@ -8,13 +8,17 @@
#include "nice_nano.dtsi"
/ {
chosen {
zmk,battery = &vbatt;
};
ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
};
vbatt {
vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
io-channels = <&adc 2>;

View File

@@ -8,6 +8,10 @@
#include "nice_nano.dtsi"
/ {
chosen {
zmk,battery = &vbatt;
};
ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
@@ -15,7 +19,7 @@
init-delay-ms = <50>;
};
vbatt {
vbatt: vbatt {
compatible = "zmk,battery-nrf-vddh";
label = "BATTERY";
};