add quantum/rgblight_post_config.h, quantum/split_common/post_config.h

Add quantum/rgblight_post_config.h and quantum/split_common/post_config.h using POST_CONFIG_H variable of build_keyboard.mk.

quantum/rgblight_post_config.h additionally defines RGBLIGHT_SPLIT if RGBLED_SPIT is defined.

quantum/split_common/post_config.h defines RGBLIGHT_SPLIT additionally when master-slave communication is I2C.
pull/5509/head
mtei 6 years ago
parent f6e8aeb971
commit 1aa14c5668

@ -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

@ -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`

@ -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

@ -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

@ -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

Loading…
Cancel
Save