diff options
| author | Joel Challis | 2025-02-28 06:46:14 +0100 |
|---|---|---|
| committer | GitHub | 2025-02-28 06:46:14 +0100 |
| commit | 6ee806f376f2bb821c1eb724645444fbf4f5a18e (patch) | |
| tree | 85aa6bca7797b7f49f4bcccc1d7aed09ac59bed0 /builddefs | |
| parent | 312f42945daede5c46d72e58dfe44b86c7666eb1 (diff) | |
Implement battery level interface (#24666)
Co-authored-by: Nick Brassel <nick@tzarc.org>
Diffstat (limited to 'builddefs')
| -rw-r--r-- | builddefs/common_features.mk | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index c88ce36011..cbfbbcced5 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -934,6 +934,28 @@ ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes) endif endif +VALID_BATTERY_DRIVER_TYPES := adc custom vendor + +BATTERY_DRIVER ?= adc +ifeq ($(strip $(BATTERY_DRIVER_REQUIRED)), yes) + ifeq ($(filter $(BATTERY_DRIVER),$(VALID_BATTERY_DRIVER_TYPES)),) + $(call CATASTROPHIC_ERROR,Invalid BATTERY_DRIVER,BATTERY_DRIVER="$(BATTERY_DRIVER)" is not a valid battery driver) + endif + + OPT_DEFS += -DBATTERY_DRIVER + OPT_DEFS += -DBATTERY_$(strip $(shell echo $(BATTERY_DRIVER) | tr '[:lower:]' '[:upper:]')) + + COMMON_VPATH += $(DRIVER_PATH)/battery + + SRC += battery.c + SRC += battery_$(strip $(BATTERY_DRIVER)).c + + # add extra deps + ifeq ($(strip $(BATTERY_DRIVER)), adc) + ANALOG_DRIVER_REQUIRED = yes + endif +endif + VALID_WS2812_DRIVER_TYPES := bitbang custom i2c pwm spi vendor WS2812_DRIVER ?= bitbang |