From dc5d4b6049167f5299dff9745c17075e4753b908 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 28 Nov 2020 22:23:54 +1100 Subject: [PATCH] Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) --- common_features.mk | 80 +++++++++---------- docs/feature_rgb_matrix.md | 9 ++- layouts/community/ortho_4x12/drashna/rules.mk | 2 +- layouts/community/split_3x6_3/bcat/rules.mk | 2 +- .../community/split_3x6_3/drashna/rules.mk | 2 +- show_options.mk | 1 + tmk_core/protocol/arm_atsam.mk | 2 +- users/tominabox1/rules.mk | 3 +- 8 files changed, 50 insertions(+), 51 deletions(-) diff --git a/common_features.mk b/common_features.mk index 41dc59acc8ee..e001233a3d9b 100644 --- a/common_features.mk +++ b/common_features.mk @@ -192,10 +192,10 @@ endif RGB_MATRIX_ENABLE ?= no -ifneq ($(strip $(RGB_MATRIX_ENABLE)), no) -ifeq ($(filter $(RGB_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),) - $(error RGB_MATRIX_ENABLE="$(RGB_MATRIX_ENABLE)" is not a valid matrix type) -endif +ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) + ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_MATRIX_TYPES)),) + $(error "$(RGB_MATRIX_DRIVER)" is not a valid matrix type) + endif OPT_DEFS += -DRGB_MATRIX_ENABLE ifneq (,$(filter $(MCU), atmega16u2 atmega32u2)) # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines @@ -206,51 +206,47 @@ endif SRC += $(QUANTUM_DIR)/rgb_matrix_drivers.c CIE1931_CURVE := yes RGB_KEYCODES_ENABLE := yes -endif -ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) - RGB_MATRIX_ENABLE := IS31FL3731 -endif - -ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3731) - OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi - SRC += is31fl3731.c - QUANTUM_LIB_SRC += i2c_master.c -endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3731) + OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE + COMMON_VPATH += $(DRIVER_PATH)/issi + SRC += is31fl3731.c + QUANTUM_LIB_SRC += i2c_master.c + endif -ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3733) - OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi - SRC += is31fl3733.c - QUANTUM_LIB_SRC += i2c_master.c -endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3733) + OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE + COMMON_VPATH += $(DRIVER_PATH)/issi + SRC += is31fl3733.c + QUANTUM_LIB_SRC += i2c_master.c + endif -ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3737) - OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi - SRC += is31fl3737.c - QUANTUM_LIB_SRC += i2c_master.c -endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3737) + OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE + COMMON_VPATH += $(DRIVER_PATH)/issi + SRC += is31fl3737.c + QUANTUM_LIB_SRC += i2c_master.c + endif -ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3741) - OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi - SRC += is31fl3741.c - QUANTUM_LIB_SRC += i2c_master.c -endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3741) + OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE + COMMON_VPATH += $(DRIVER_PATH)/issi + SRC += is31fl3741.c + QUANTUM_LIB_SRC += i2c_master.c + endif -ifeq ($(strip $(RGB_MATRIX_ENABLE)), WS2812) - OPT_DEFS += -DWS2812 - WS2812_DRIVER_REQUIRED := yes -endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), WS2812) + OPT_DEFS += -DWS2812 + WS2812_DRIVER_REQUIRED := yes + endif -ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes) - OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB -endif + ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes) + OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB + endif -ifeq ($(strip $(RGB_MATRIX_CUSTOM_USER)), yes) - OPT_DEFS += -DRGB_MATRIX_CUSTOM_USER + ifeq ($(strip $(RGB_MATRIX_CUSTOM_USER)), yes) + OPT_DEFS += -DRGB_MATRIX_CUSTOM_USER + endif endif ifeq ($(strip $(RGB_KEYCODES_ENABLE)), yes) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 6e24fdaeedcd..f8b0653551f4 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -11,7 +11,8 @@ If you want to use single color LED's you should use the [LED Matrix Subsystem]( There is basic support for addressable RGB matrix lighting with the I2C IS31FL3731 RGB controller. To enable it, add this to your `rules.mk`: ```makefile -RGB_MATRIX_ENABLE = IS31FL3731 +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = IS31FL3731 ``` Configure the hardware via your `config.h`: @@ -62,7 +63,8 @@ Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet] There is basic support for addressable RGB matrix lighting with the I2C IS31FL3733 RGB controller. To enable it, add this to your `rules.mk`: ```makefile -RGB_MATRIX_ENABLE = IS31FL3733 +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = IS31FL3733 ``` Configure the hardware via your `config.h`: @@ -112,7 +114,8 @@ Where `X_Y` is the location of the LED in the matrix defined by [the datasheet]( There is basic support for addressable RGB matrix lighting with a WS2811/WS2812{a,b,c} addressable LED strand. To enable it, add this to your `rules.mk`: ```makefile -RGB_MATRIX_ENABLE = WS2812 +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 ``` Configure the hardware via your `config.h`: diff --git a/layouts/community/ortho_4x12/drashna/rules.mk b/layouts/community/ortho_4x12/drashna/rules.mk index 3383cfd35f3b..2a9576758f31 100644 --- a/layouts/community/ortho_4x12/drashna/rules.mk +++ b/layouts/community/ortho_4x12/drashna/rules.mk @@ -34,7 +34,7 @@ ifeq ($(strip $(KEYBOARD)), planck/ez) RGBLIGHT_ENABLE = no # SERIAL_LINK_ENABLE = yes ENCODER_ENABLE = yes - RGB_MATRIX_ENABLE = IS31FL3737 + RGB_MATRIX_ENABLE = yes INDICATOR_LIGHTS = yes RGBLIGHT_TWINKLE = yes RGBLIGHT_STARTUP_ANIMATION = yes diff --git a/layouts/community/split_3x6_3/bcat/rules.mk b/layouts/community/split_3x6_3/bcat/rules.mk index 3a9796673eae..caf6ec7ece75 100644 --- a/layouts/community/split_3x6_3/bcat/rules.mk +++ b/layouts/community/split_3x6_3/bcat/rules.mk @@ -6,5 +6,5 @@ ifeq ($(strip $(KEYBOARD)), crkbd/rev1/common) else ifeq ($(strip $(KEYBOARD)), crkbd/rev1/legacy) BOOTLOADER = atmel-dfu # Elite-C - RGB_MATRIX_ENABLE = WS2812 # per-key RGB and underglow + RGB_MATRIX_ENABLE = yes # per-key RGB and underglow endif diff --git a/layouts/community/split_3x6_3/drashna/rules.mk b/layouts/community/split_3x6_3/drashna/rules.mk index 6ac1554b330a..46f543f4e8fc 100644 --- a/layouts/community/split_3x6_3/drashna/rules.mk +++ b/layouts/community/split_3x6_3/drashna/rules.mk @@ -22,7 +22,7 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend ifeq ($(strip $(KEYBOARD)), crkbd/rev1) OLED_DRIVER_ENABLE = yes - RGB_MATRIX_ENABLE = WS2812 + RGB_MATRIX_ENABLE = yes HAPTIC_ENABLE = SOLENOID BOOTLOADER = qmk-dfu endif diff --git a/show_options.mk b/show_options.mk index 2a5781773502..df3d03957120 100644 --- a/show_options.mk +++ b/show_options.mk @@ -20,6 +20,7 @@ HARDWARE_OPTION_NAMES = \ RGBLIGHT_ENABLE \ RGBLIGHT_CUSTOM_DRIVER \ RGB_MATRIX_ENABLE \ + RGB_MATRIX_DRIVER \ SERIAL_LINK_ENABLE \ CIE1931_CURVE \ MIDI_ENABLE \ diff --git a/tmk_core/protocol/arm_atsam.mk b/tmk_core/protocol/arm_atsam.mk index 0e4a20f475e4..5bb45d658e51 100644 --- a/tmk_core/protocol/arm_atsam.mk +++ b/tmk_core/protocol/arm_atsam.mk @@ -4,7 +4,7 @@ SRC += $(ARM_ATSAM_DIR)/adc.c SRC += $(ARM_ATSAM_DIR)/clks.c SRC += $(ARM_ATSAM_DIR)/d51_util.c SRC += $(ARM_ATSAM_DIR)/i2c_master.c -ifeq ($(RGB_MATRIX_ENABLE),custom) +ifeq ($(RGB_MATRIX_DRIVER),custom) SRC += $(ARM_ATSAM_DIR)/md_rgb_matrix_programs.c SRC += $(ARM_ATSAM_DIR)/md_rgb_matrix.c endif diff --git a/users/tominabox1/rules.mk b/users/tominabox1/rules.mk index b70b128cf3e5..22b6a858f4b3 100644 --- a/users/tominabox1/rules.mk +++ b/users/tominabox1/rules.mk @@ -8,7 +8,7 @@ NKRO_ENABLE = yes BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration ifeq ($(strip $(KEYBOARD)), crkbd/rev1) -RGB_MATRIX_ENABLE = WS2812 +RGB_MATRIX_ENABLE = yes EXTRAFLAGS += -flto BOOTLOADER = qmk-dfu OLED_DRIVER_ENABLE = yes @@ -19,7 +19,6 @@ MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -# RGB_MATRIX_ENABLE = WS2812 endif