aboutsummaryrefslogtreecommitdiff
path: root/quantum/split_common/transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/split_common/transport.c')
-rw-r--r--quantum/split_common/transport.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c
index 631d913f7..8d408f6fd 100644
--- a/quantum/split_common/transport.c
+++ b/quantum/split_common/transport.c
@@ -92,12 +92,13 @@ typedef struct _Serial_m2s_buffer_t {
92# ifdef BACKLIGHT_ENABLE 92# ifdef BACKLIGHT_ENABLE
93 uint8_t backlight_level; 93 uint8_t backlight_level;
94# endif 94# endif
95# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 95# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT)
96 rgblight_config_t rgblight_config; // not yet use 96 rgblight_config_t rgblight_config; // not yet use
97 // 97 //
98 // When MCUs on both sides drive their respective RGB LED chains, 98 // When MCUs on both sides drive their respective RGB LED chains,
99 // it is necessary to synchronize, so it is necessary to communicate RGB 99 // it is necessary to synchronize, so it is necessary to communicate RGB
100 // information. In that case, define the RGBLIGHT_SPLIT macro. 100 // information. In that case, define RGBLED_SPLIT with info on the number
101 // of LEDs on each half.
101 // 102 //
102 // Otherwise, if the master side MCU drives both sides RGB LED chains, 103 // Otherwise, if the master side MCU drives both sides RGB LED chains,
103 // there is no need to communicate. 104 // there is no need to communicate.
@@ -132,15 +133,20 @@ bool transport_master(matrix_row_t matrix[]) {
132 matrix[i] = serial_s2m_buffer.smatrix[i]; 133 matrix[i] = serial_s2m_buffer.smatrix[i];
133 } 134 }
134 135
135# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
136 // Code to send RGB over serial goes here (not implemented yet)
137# endif
138
139# ifdef BACKLIGHT_ENABLE 136# ifdef BACKLIGHT_ENABLE
140 // Write backlight level for slave to read 137 // Write backlight level for slave to read
141 serial_m2s_buffer.backlight_level = backlight_config.enable ? backlight_config.level : 0; 138 serial_m2s_buffer.backlight_level = backlight_config.enable ? backlight_config.level : 0;
142# endif 139# endif
143 140
141# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT)
142 static rgblight_config_t prev_rgb = {~0};
143 uint32_t rgb = rgblight_read_dword();
144 if (rgb != prev_rgb.raw) {
145 serial_m2s_buffer.rgblight_config.raw = rgb;
146 prev_rgb.raw = rgb;
147 }
148# endif
149
144 return true; 150 return true;
145} 151}
146 152
@@ -152,8 +158,9 @@ void transport_slave(matrix_row_t matrix[]) {
152# ifdef BACKLIGHT_ENABLE 158# ifdef BACKLIGHT_ENABLE
153 backlight_set(serial_m2s_buffer.backlight_level); 159 backlight_set(serial_m2s_buffer.backlight_level);
154# endif 160# endif
155# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 161# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT)
156// Add serial implementation for RGB here 162 // Update RGB config with the new data
163 rgblight_update_dword(serial_m2s_buffer.rgblight_config.raw);
157# endif 164# endif
158} 165}
159 166