diff --git a/common_features.mk b/common_features.mk index 046f94d1dbe..c06a160a457 100644 --- a/common_features.mk +++ b/common_features.mk @@ -103,6 +103,7 @@ ifeq ($(strip $(UNICODE_COMMON)), yes) endif ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) + POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h OPT_DEFS += -DRGBLIGHT_ENABLE SRC += $(QUANTUM_DIR)/rgblight.c CIE1931_CURVE = yes @@ -305,6 +306,7 @@ ifneq ($(strip $(DEBOUNCE_TYPE)), custom) endif ifeq ($(strip $(SPLIT_KEYBOARD)), yes) + POST_CONFIG_H += $(QUANTUM_DIR)/split_common/post_config.h OPT_DEFS += -DSPLIT_KEYBOARD # Include files used by all split keyboards diff --git a/docs/config_options.md b/docs/config_options.md index ad42e978020..ac64507bd1f 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -176,10 +176,12 @@ If you define these options you will enable the associated feature, which may in * run RGB animations * `#define RGBLED_NUM 12` * number of LEDs +* `#define RGBLIGHT_SPLIT` + * Needed if both halves of the board have RGB LEDs wired directly to the RGB output pin on the controllers instead of passing the output of the left half to the input of the right half * `#define RGBLED_SPLIT { 6, 6 }` * number of LEDs connected that are directly wired to `RGB_DI_PIN` on each half of a split keyboard * First value indicates number of LEDs for left half, second value is for the right half - * Needed if both halves of the board have RGB LEDs wired directly to the RGB output pin on the controllers instead of passing the output of the left half to the input of the right half + * When RGBLED_SPLIT is defined, it is considered that RGBLIGHT_SPLIT is defined implicitly. * `#define RGBLIGHT_HUE_STEP 12` * units to step when in/decreasing hue * `#define RGBLIGHT_SAT_STEP 25` diff --git a/quantum/rgblight_post_config.h b/quantum/rgblight_post_config.h new file mode 100644 index 00000000000..048746c4b7d --- /dev/null +++ b/quantum/rgblight_post_config.h @@ -0,0 +1,5 @@ +#if defined(RGBLED_SPLIT) && !defined(RGBLIGHT_SPLIT) + // When RGBLED_SPLIT is defined, + // it is considered that RGBLIGHT_SPLIT is defined implicitly. + #define RGBLIGHT_SPLIT +#endif diff --git a/quantum/split_common/post_config.h b/quantum/split_common/post_config.h new file mode 100644 index 00000000000..e67f95defa1 --- /dev/null +++ b/quantum/split_common/post_config.h @@ -0,0 +1,11 @@ +#if defined(USE_I2C) || defined(EH) + // When using I2C, using rgblight implicitly involves split support. + #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_SPLIT) + #define RGBLIGHT_SPLIT + #endif + +#else // use serial + // When using serial, the user must define RGBLIGHT_SPLIT explicitly + // in config.h as needed. + // see quantum/rgblight_post_config.h +#endif diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 5c130e009f8..6a3ebee667a 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -99,12 +99,12 @@ typedef struct _Serial_m2s_buffer_t { # ifdef BACKLIGHT_ENABLE uint8_t backlight_level; # endif -# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) +# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) rgblight_config_t rgblight_config; // not yet use // // When MCUs on both sides drive their respective RGB LED chains, // it is necessary to synchronize, so it is necessary to communicate RGB - // information. In that case, define RGBLED_SPLIT with info on the number + // information. In that case, define RGBLIGHT_SPLIT with info on the number // of LEDs on each half. // // Otherwise, if the master side MCU drives both sides RGB LED chains, @@ -145,7 +145,7 @@ bool transport_master(matrix_row_t matrix[]) { serial_m2s_buffer.backlight_level = backlight_config.enable ? backlight_config.level : 0; # endif -# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) +# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) static rgblight_config_t prev_rgb = {~0}; uint32_t rgb = rgblight_read_dword(); if (rgb != prev_rgb.raw) { @@ -165,7 +165,7 @@ void transport_slave(matrix_row_t matrix[]) { # ifdef BACKLIGHT_ENABLE backlight_set(serial_m2s_buffer.backlight_level); # endif -# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) +# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) // Update RGB config with the new data rgblight_update_dword(serial_m2s_buffer.rgblight_config.raw); # endif