diff options
author | Ryan <fauxpark@gmail.com> | 2021-04-22 19:21:13 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 19:21:13 +1000 |
commit | d6ab908272e7f8f391b19aee0c8a9dce9b24f511 (patch) | |
tree | fa25f706d1a11c5ebea4c03b59d217542ab47475 /quantum/split_common | |
parent | 5d458c6c8ae6dcddec7dde87087b5169673ce69c (diff) | |
download | qmk_firmware-d6ab908272e7f8f391b19aee0c8a9dce9b24f511.tar.gz qmk_firmware-d6ab908272e7f8f391b19aee0c8a9dce9b24f511.zip |
LED Matrix: Split (#12633)
Diffstat (limited to 'quantum/split_common')
-rw-r--r-- | quantum/split_common/transport.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 27a1c0d3a..7ea925b51 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c | |||
@@ -22,6 +22,9 @@ static pin_t encoders_pad[] = ENCODERS_PAD_A; | |||
22 | # define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t)) | 22 | # define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t)) |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) | ||
26 | # include "led_matrix.h" | ||
27 | #endif | ||
25 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | 28 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) |
26 | # include "rgb_matrix.h" | 29 | # include "rgb_matrix.h" |
27 | #endif | 30 | #endif |
@@ -58,6 +61,10 @@ typedef struct _I2C_slave_buffer_t { | |||
58 | # ifdef WPM_ENABLE | 61 | # ifdef WPM_ENABLE |
59 | uint8_t current_wpm; | 62 | uint8_t current_wpm; |
60 | # endif | 63 | # endif |
64 | # if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) | ||
65 | led_eeconfig_t led_matrix; | ||
66 | bool led_suspend_state; | ||
67 | # endif | ||
61 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | 68 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) |
62 | rgb_config_t rgb_matrix; | 69 | rgb_config_t rgb_matrix; |
63 | bool rgb_suspend_state; | 70 | bool rgb_suspend_state; |
@@ -76,6 +83,8 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re | |||
76 | # define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) | 83 | # define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) |
77 | # define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) | 84 | # define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) |
78 | # define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) | 85 | # define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) |
86 | # define I2C_LED_MATRIX_START offsetof(I2C_slave_buffer_t, led_matrix) | ||
87 | # define I2C_LED_SUSPEND_START offsetof(I2C_slave_buffer_t, led_suspend_state) | ||
79 | # define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix) | 88 | # define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix) |
80 | # define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state) | 89 | # define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state) |
81 | 90 | ||
@@ -151,6 +160,10 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) | |||
151 | # endif | 160 | # endif |
152 | # endif | 161 | # endif |
153 | 162 | ||
163 | # if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) | ||
164 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_MATRIX_START, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix), TIMEOUT); | ||
165 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_SUSPEND_START, (void *)g_suspend_state, sizeof(i2c_buffer->led_suspend_state), TIMEOUT); | ||
166 | # endif | ||
154 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | 167 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) |
155 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT); | 168 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT); |
156 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_SUSPEND_START, (void *)g_suspend_state, sizeof(i2c_buffer->rgb_suspend_state), TIMEOUT); | 169 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_SUSPEND_START, (void *)g_suspend_state, sizeof(i2c_buffer->rgb_suspend_state), TIMEOUT); |
@@ -202,6 +215,10 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) | |||
202 | # endif | 215 | # endif |
203 | # endif | 216 | # endif |
204 | 217 | ||
218 | # if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) | ||
219 | memcpy((void*)i2c_buffer->led_matrix, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix)); | ||
220 | memcpy((void*)i2c_buffer->led_suspend_state, (void *)g_suspend_state, sizeof(i2c_buffer->led_suspend_state)); | ||
221 | # endif | ||
205 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | 222 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) |
206 | memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix)); | 223 | memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix)); |
207 | memcpy((void *)i2c_buffer->rgb_suspend_state, (void *)g_suspend_state, sizeof(i2c_buffer->rgb_suspend_state)); | 224 | memcpy((void *)i2c_buffer->rgb_suspend_state, (void *)g_suspend_state, sizeof(i2c_buffer->rgb_suspend_state)); |
@@ -246,6 +263,10 @@ typedef struct _Serial_m2s_buffer_t { | |||
246 | # ifdef WPM_ENABLE | 263 | # ifdef WPM_ENABLE |
247 | uint8_t current_wpm; | 264 | uint8_t current_wpm; |
248 | # endif | 265 | # endif |
266 | # if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) | ||
267 | led_eeconfig_t led_matrix; | ||
268 | bool led_suspend_state; | ||
269 | # endif | ||
249 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | 270 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) |
250 | rgb_config_t rgb_matrix; | 271 | rgb_config_t rgb_matrix; |
251 | bool rgb_suspend_state; | 272 | bool rgb_suspend_state; |
@@ -368,6 +389,10 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) | |||
368 | # endif | 389 | # endif |
369 | # endif | 390 | # endif |
370 | 391 | ||
392 | # if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) | ||
393 | serial_m2s_buffer.led_matrix = led_matrix_econfig; | ||
394 | serial_m2s_buffer.led_suspend_state = g_suspend_state; | ||
395 | # endif | ||
371 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | 396 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) |
372 | serial_m2s_buffer.rgb_matrix = rgb_matrix_config; | 397 | serial_m2s_buffer.rgb_matrix = rgb_matrix_config; |
373 | serial_m2s_buffer.rgb_suspend_state = g_suspend_state; | 398 | serial_m2s_buffer.rgb_suspend_state = g_suspend_state; |
@@ -412,6 +437,10 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) | |||
412 | # endif | 437 | # endif |
413 | # endif | 438 | # endif |
414 | 439 | ||
440 | # if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) | ||
441 | led_matrix_eeconfig = serial_m2s_buffer.led_matrix; | ||
442 | g_suspend_state = serial_m2s_buffer.led_suspend_state; | ||
443 | # endif | ||
415 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | 444 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) |
416 | rgb_matrix_config = serial_m2s_buffer.rgb_matrix; | 445 | rgb_matrix_config = serial_m2s_buffer.rgb_matrix; |
417 | g_suspend_state = serial_m2s_buffer.rgb_suspend_state; | 446 | g_suspend_state = serial_m2s_buffer.rgb_suspend_state; |