aboutsummaryrefslogtreecommitdiffstats
path: root/common_features.mk
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-10-29 22:53:11 +0000
committerDrashna Jaelre <drashna@live.com>2019-10-29 15:53:11 -0700
commit64b7cfe735339193ae78fe0f13029b0e027af7a7 (patch)
tree2fcad9781c786061dae9b4dec7d799f7072ad600 /common_features.mk
parent908aede957a66e65d37601fa67548c369137b57b (diff)
downloadfirmware-64b7cfe735339193ae78fe0f13029b0e027af7a7.tar.gz
firmware-64b7cfe735339193ae78fe0f13029b0e027af7a7.tar.bz2
firmware-64b7cfe735339193ae78fe0f13029b0e027af7a7.zip
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 <drashna@live.com>
Diffstat (limited to 'common_features.mk')
-rw-r--r--common_features.mk24
1 files changed, 22 insertions, 2 deletions
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