diff options
| author | Joel Challis <git@zvecr.com> | 2025-02-28 05:46:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-28 16:46:14 +1100 |
| 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) | |||
| 934 | endif | 934 | endif |
| 935 | endif | 935 | endif |
| 936 | 936 | ||
| 937 | VALID_BATTERY_DRIVER_TYPES := adc custom vendor | ||
| 938 | |||
| 939 | BATTERY_DRIVER ?= adc | ||
| 940 | ifeq ($(strip $(BATTERY_DRIVER_REQUIRED)), yes) | ||
| 941 | ifeq ($(filter $(BATTERY_DRIVER),$(VALID_BATTERY_DRIVER_TYPES)),) | ||
| 942 | $(call CATASTROPHIC_ERROR,Invalid BATTERY_DRIVER,BATTERY_DRIVER="$(BATTERY_DRIVER)" is not a valid battery driver) | ||
| 943 | endif | ||
| 944 | |||
| 945 | OPT_DEFS += -DBATTERY_DRIVER | ||
| 946 | OPT_DEFS += -DBATTERY_$(strip $(shell echo $(BATTERY_DRIVER) | tr '[:lower:]' '[:upper:]')) | ||
| 947 | |||
| 948 | COMMON_VPATH += $(DRIVER_PATH)/battery | ||
| 949 | |||
| 950 | SRC += battery.c | ||
| 951 | SRC += battery_$(strip $(BATTERY_DRIVER)).c | ||
| 952 | |||
| 953 | # add extra deps | ||
| 954 | ifeq ($(strip $(BATTERY_DRIVER)), adc) | ||
| 955 | ANALOG_DRIVER_REQUIRED = yes | ||
| 956 | endif | ||
| 957 | endif | ||
| 958 | |||
| 937 | VALID_WS2812_DRIVER_TYPES := bitbang custom i2c pwm spi vendor | 959 | VALID_WS2812_DRIVER_TYPES := bitbang custom i2c pwm spi vendor |
| 938 | 960 | ||
| 939 | WS2812_DRIVER ?= bitbang | 961 | WS2812_DRIVER ?= bitbang |
