From f8cea06be3f364e35b5f33c13cf025f010ab158f Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 21 Sep 2023 15:50:01 +1000 Subject: [PATCH] RGBLight/Backlight: add prefixed driver defines (#22089) --- builddefs/common_features.mk | 6 ++---- keyboards/mxss/rgblight.c | 2 +- quantum/rgb_matrix/rgb_matrix_drivers.c | 2 +- quantum/rgblight/rgblight.c | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 2dd759973d..a594e2b1d5 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -328,6 +328,7 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) COMMON_VPATH += $(QUANTUM_DIR)/rgblight POST_CONFIG_H += $(QUANTUM_DIR)/rgblight/rgblight_post_config.h OPT_DEFS += -DRGBLIGHT_ENABLE + OPT_DEFS += -DRGBLIGHT_$(strip $(shell echo $(RGBLIGHT_DRIVER) | tr '[:lower:]' '[:upper:]')) SRC += $(QUANTUM_DIR)/color.c SRC += $(QUANTUM_DIR)/rgblight/rgblight.c CIE1931_CURVE := yes @@ -341,10 +342,6 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) ifeq ($(strip $(RGBLIGHT_DRIVER)), apa102) APA102_DRIVER_REQUIRED := yes endif - - ifeq ($(strip $(RGBLIGHT_DRIVER)), custom) - OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER - endif endif # Deprecated driver names - do not use @@ -584,6 +581,7 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) SRC += $(QUANTUM_DIR)/backlight/backlight.c SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c OPT_DEFS += -DBACKLIGHT_ENABLE + OPT_DEFS += -DBACKLIGHT_$(strip $(shell echo $(BACKLIGHT_DRIVER) | tr '[:lower:]' '[:upper:]')) ifneq ($(strip $(BACKLIGHT_DRIVER)), custom) SRC += $(QUANTUM_DIR)/backlight/backlight_driver_common.c diff --git a/keyboards/mxss/rgblight.c b/keyboards/mxss/rgblight.c index 873139b5c6..9809020a81 100644 --- a/keyboards/mxss/rgblight.c +++ b/keyboards/mxss/rgblight.c @@ -739,7 +739,7 @@ void rgblight_unblink_layers(void) { __attribute__((weak)) void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); } -#ifndef RGBLIGHT_CUSTOM_DRIVER +#ifndef RGBLIGHT_CUSTOM void rgblight_set(void) { rgb_led_t *start_led; uint8_t num_leds = rgblight_ranges.clipping_num_leds; diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 368459db40..58b707bf7f 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -440,7 +440,7 @@ const rgb_matrix_driver_t rgb_matrix_driver = { }; #elif defined(RGB_MATRIX_WS2812) -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_CUSTOM_DRIVER) +# if defined(RGBLIGHT_WS2812) # pragma message "Cannot use RGBLIGHT and RGB Matrix using WS2812 at the same time." # pragma message "You need to use a custom driver, or re-implement the WS2812 driver to use a different configuration." # endif diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index 70672ceb8f..d6dd432c83 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -901,7 +901,7 @@ __attribute__((weak)) void rgblight_call_driver(rgb_led_t *start_led, uint8_t nu ws2812_setleds(start_led, num_leds); } -#ifndef RGBLIGHT_CUSTOM_DRIVER +#ifndef RGBLIGHT_CUSTOM void rgblight_set(void) { rgb_led_t *start_led;