aboutsummaryrefslogtreecommitdiff
path: root/quantum/split_common/transport.c
diff options
context:
space:
mode:
authorDanny <nooges@users.noreply.github.com>2019-03-23 20:20:14 -0400
committerDrashna Jaelre <drashna@live.com>2019-03-23 17:20:14 -0700
commitf077204fae729e66f8dfa16db82263ff2ff84d59 (patch)
treedbd23687e838271e9f90b7dab25b0312745eb5e3 /quantum/split_common/transport.c
parent23086808a78c9234232e2ddbf0c977d1fb2cb6ae (diff)
downloadqmk_firmware-f077204fae729e66f8dfa16db82263ff2ff84d59.tar.gz
qmk_firmware-f077204fae729e66f8dfa16db82263ff2ff84d59.zip
Add support for RGB LEDs wired directly to each half's controller (#5392)
* Add support for wiring RGB LEDs for both halves directly to their respective controllers RGB LEDs for each half don't need to be chained together across the TRRS cable with this * Add split RGB LED support for serial * Update config/rules for bakingpy layout * Un-nest ifdefs for hand detection * Read RGB config state from memory instead of EEPROM for serial updates * Reuse existing LED pointer instead of creating new one
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