From 64b7cfe735339193ae78fe0f13029b0e027af7a7 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Tue, 29 Oct 2019 22:53:11 +0000 Subject: Refactor ps2avrgb i2c ws2812 to core (#7183) * Refactor ps2avrgb i2c ws2812 to core * Refactor jj40 to use ws2812 i2c driver * Refactor ps2avrgb template to use ws2812 i2c driver * Add ws2812 stub files * clang-format and driver config * Add ws2812 driver docs * Fix default config values * Update tmk_core/protocol/vusb/main.c Co-Authored-By: Drashna Jaelre --- common_features.mk | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'common_features.mk') diff --git a/common_features.mk b/common_features.mk index 83b2b51ae..7bb9187bb 100644 --- a/common_features.mk +++ b/common_features.mk @@ -112,7 +112,7 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER else - SRC += ws2812.c + WS2812_DRIVER_REQUIRED = yes endif endif @@ -176,7 +176,7 @@ endif ifeq ($(strip $(RGB_MATRIX_ENABLE)), WS2812) OPT_DEFS += -DWS2812 - SRC += ws2812.c + WS2812_DRIVER_REQUIRED = yes endif ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes) @@ -262,6 +262,26 @@ ifneq ($(strip $(BACKLIGHT_ENABLE)), no) endif endif +VALID_WS2812_DRIVER_TYPES := bitbang pwm spi i2c + +WS2812_DRIVER ?= bitbang +ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes) + ifeq ($(filter $(WS2812_DRIVER),$(VALID_WS2812_DRIVER_TYPES)),) + $(error WS2812_DRIVER="$(WS2812_DRIVER)" is not a valid WS2812 driver) + endif + + ifeq ($(strip $(WS2812_DRIVER)), bitbang) + SRC += ws2812.c + else + SRC += ws2812_$(strip $(WS2812_DRIVER)).c + endif + + # add extra deps + ifeq ($(strip $(WS2812_DRIVER)), i2c) + QUANTUM_LIB_SRC += i2c_master.c + endif +endif + ifeq ($(strip $(CIE1931_CURVE)), yes) OPT_DEFS += -DUSE_CIE1931_CURVE LED_TABLES = yes -- cgit v1.2.3