summaryrefslogtreecommitdiffstats
path: root/common_features.mk
diff options
context:
space:
mode:
authorAldehir Rojas <hello@aldehir.com>2020-12-29 18:28:49 -0600
committerGitHub <noreply@github.com>2020-12-30 00:28:49 +0000
commit4f2f21dc05c70451593ba83ed7a0956c771850c2 (patch)
tree266942c390a6b8d78d6f7c2994039a5f8b2eba98 /common_features.mk
parent7dd99f2b22a34143c0443154d9cd97540443b096 (diff)
Rewrite APA102 support (#10894)
* Rewrite APA102 support The APA102 source was broken by commit 16a15c1cfcbfd0feb2c2cf1383676747e2f97d73 as it did not include the quantum header. This commit addresses that, as well as other issues with transferring bytes over the SPI interface, i.e. it was not setting the clock pin back to low after sending a bit. The deviation when sending the end frame is kept, but updated to the latest from the referenced project. Finally, these changes expose the global LED brightness parameter of the APA102. Brightness values are configurable through `APA102_DEFAULT_BRIGHTNESS` and `APA102_MAX_BRIGHTNESS`. * Fix typo in led brightness extern * Move driver out of AVR directory and add delay for ARM * Experimental APA102 support on AVR and ARM Co-authored-by: Alde Rojas <hello@alde.io> * Refactor apa102_send_byte() calls to a loop * Implement io_wait function for ARM * Move APA102 drivers to own directory, fix copyright notice * Add APA102 keymap to handwired/onekey * Simplify RGBLIGHT_ENABLE/DRIVER option handling Co-authored-by: Mikkel Jeppesen <2756925+Duckle29@users.noreply.github.com>
Diffstat (limited to 'common_features.mk')
-rw-r--r--common_features.mk46
1 files changed, 38 insertions, 8 deletions
diff --git a/common_features.mk b/common_features.mk
index 8ac53ec45a..95b59937cd 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -154,18 +154,38 @@ else
endif
endif
+RGBLIGHT_ENABLE ?= no
+VALID_RGBLIGHT_TYPES := WS2812 APA102 custom
+
+ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
+ RGBLIGHT_DRIVER ?= custom
+endif
+
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
- POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h
- OPT_DEFS += -DRGBLIGHT_ENABLE
- SRC += $(QUANTUM_DIR)/color.c
- SRC += $(QUANTUM_DIR)/rgblight.c
- CIE1931_CURVE := yes
- RGB_KEYCODES_ENABLE := yes
- ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
- OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
+ RGBLIGHT_DRIVER ?= WS2812
+
+ ifeq ($(filter $(RGBLIGHT_DRIVER),$(VALID_RGBLIGHT_TYPES)),)
+ $(error RGBLIGHT_DRIVER="$(RGBLIGHT_DRIVER)" is not a valid RGB type)
else
+ POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h
+ OPT_DEFS += -DRGBLIGHT_ENABLE
+ SRC += $(QUANTUM_DIR)/color.c
+ SRC += $(QUANTUM_DIR)/rgblight.c
+ CIE1931_CURVE := yes
+ RGB_KEYCODES_ENABLE := yes
+ endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), WS2812)
WS2812_DRIVER_REQUIRED := yes
endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), APA102)
+ APA102_DRIVER_REQUIRED := yes
+ endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), custom)
+ OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
+ endif
endif
@@ -243,6 +263,11 @@ endif
WS2812_DRIVER_REQUIRED := yes
endif
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), APA102)
+ OPT_DEFS += -DAPA102
+ APA102_DRIVER_REQUIRED := yes
+ endif
+
ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes)
OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB
endif
@@ -345,6 +370,11 @@ ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
endif
endif
+ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes)
+ COMMON_VPATH += $(DRIVER_PATH)/apa102
+ SRC += apa102.c
+endif
+
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
CIE1931_CURVE := yes
endif