1
0
Fork 0

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.
This commit is contained in:
Nick Brassel 2021-02-15 08:56:13 +11:00 committed by GitHub
parent c27a778281
commit f53e41ac81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 133 additions and 0 deletions

View file

@ -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