Skip to content

Commit

Permalink
Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (qmk#10231)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored Nov 28, 2020
1 parent 793300a commit dc5d4b6
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 51 deletions.
80 changes: 38 additions & 42 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
9 changes: 6 additions & 3 deletions docs/feature_rgb_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down Expand Up @@ -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`:
Expand Down Expand Up @@ -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`:
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/drashna/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/split_3x6_3/bcat/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion layouts/community/split_3x6_3/drashna/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions show_options.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion tmk_core/protocol/arm_atsam.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions users/tominabox1/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand Down

0 comments on commit dc5d4b6

Please sign in to comment.