diff options
Diffstat (limited to 'builddefs')
-rw-r--r-- | builddefs/common_features.mk | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index d0702f3ad1..9ac95dae82 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -744,17 +744,28 @@ endif VALID_OLED_DRIVER_TYPES := SSD1306 custom OLED_DRIVER ?= SSD1306 +VALID_OLED_TRANSPORT_TYPES := i2c spi custom +OLED_TRANSPORT ?= i2c ifeq ($(strip $(OLED_ENABLE)), yes) ifeq ($(filter $(OLED_DRIVER),$(VALID_OLED_DRIVER_TYPES)),) $(call CATASTROPHIC_ERROR,Invalid OLED_DRIVER,OLED_DRIVER="$(OLED_DRIVER)" is not a valid OLED driver) else - OPT_DEFS += -DOLED_ENABLE - COMMON_VPATH += $(DRIVER_PATH)/oled + ifeq ($(filter $(OLED_TRANSPORT),$(VALID_OLED_TRANSPORT_TYPES)),) + $(call CATASTROPHIC_ERROR,Invalid OLED_TRANSPORT,OLED_TRANSPORT="$(OLED_TRANSPORT)" is not a valid OLED transport) + else + OPT_DEFS += -DOLED_ENABLE + COMMON_VPATH += $(DRIVER_PATH)/oled + ifneq ($(strip $(OLED_DRIVER)), custom) + SRC += oled_driver.c + endif - OPT_DEFS += -DOLED_DRIVER_$(strip $(shell echo $(OLED_DRIVER) | tr '[:lower:]' '[:upper:]')) - ifeq ($(strip $(OLED_DRIVER)), SSD1306) - SRC += ssd1306_sh1106.c - QUANTUM_LIB_SRC += i2c_master.c + OPT_DEFS += -DOLED_TRANSPORT_$(strip $(shell echo $(OLED_TRANSPORT) | tr '[:lower:]' '[:upper:]')) + ifeq ($(strip $(OLED_TRANSPORT)), i2c) + QUANTUM_LIB_SRC += i2c_master.c + endif + ifeq ($(strip $(OLED_TRANSPORT)), spi) + QUANTUM_LIB_SRC += spi_master.c + endif endif endif endif |