From f53e41ac81662a560a299a23c7863dd2f618a1f8 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 15 Feb 2021 08:56:13 +1100 Subject: Add support for analog USBPD on STM32G4xx. (#11824) * Add support for analog USBPD on STM32G4xx. * Split up to a list of driver types, allow for custom. --- common_features.mk | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'common_features.mk') diff --git a/common_features.mk b/common_features.mk index ecb4f5576b..8338ce4080 100644 --- a/common_features.mk +++ b/common_features.mk @@ -631,3 +631,27 @@ endif ifeq ($(strip $(JOYSTICK_ENABLE)), digital) OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE endif + +USBPD_ENABLE ?= no +VALID_USBPD_DRIVER_TYPES = custom vendor +USBPD_DRIVER ?= vendor +ifeq ($(strip $(USBPD_ENABLE)), yes) + ifeq ($(filter $(strip $(USBPD_DRIVER)),$(VALID_USBPD_DRIVER_TYPES)),) + $(error USBPD_DRIVER="$(USBPD_DRIVER)" is not a valid USBPD driver) + else + OPT_DEFS += -DUSBPD_ENABLE + ifeq ($(strip $(USBPD_DRIVER)), vendor) + # Vendor-specific implementations + OPT_DEFS += -DUSBPD_VENDOR + ifeq ($(strip $(MCU_SERIES)), STM32G4xx) + OPT_DEFS += -DUSBPD_STM32G4 + SRC += usbpd_stm32g4.c + else + $(error There is no vendor-provided USBPD driver available) + endif + else ifeq ($(strip $(USBPD_DRIVER)), custom) + OPT_DEFS += -DUSBPD_CUSTOM + # Board designers can add their own driver to $(SRC) + endif + endif +endif \ No newline at end of file -- cgit v1.2.3