summaryrefslogtreecommitdiff
path: root/quantum/split_common
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-04-22 19:21:13 +1000
committerGitHub <noreply@github.com>2021-04-22 19:21:13 +1000
commitd6ab908272e7f8f391b19aee0c8a9dce9b24f511 (patch)
treefa25f706d1a11c5ebea4c03b59d217542ab47475 /quantum/split_common
parent5d458c6c8ae6dcddec7dde87087b5169673ce69c (diff)
LED Matrix: Split (#12633)
Diffstat (limited to 'quantum/split_common')
-rw-r--r--quantum/split_common/transport.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c
index 27a1c0d3a4..7ea925b513 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;
# define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t))
#endif
+#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+# include "led_matrix.h"
+#endif
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
# include "rgb_matrix.h"
#endif
@@ -58,6 +61,10 @@ typedef struct _I2C_slave_buffer_t {
# ifdef WPM_ENABLE
uint8_t current_wpm;
# endif
+# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+ led_eeconfig_t led_matrix;
+ bool led_suspend_state;
+# endif
# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
rgb_config_t rgb_matrix;
bool rgb_suspend_state;
@@ -76,6 +83,8 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re
# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync)
# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state)
# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm)
+# define I2C_LED_MATRIX_START offsetof(I2C_slave_buffer_t, led_matrix)
+# define I2C_LED_SUSPEND_START offsetof(I2C_slave_buffer_t, led_suspend_state)
# define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix)
# define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state)
@@ -151,6 +160,10 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[])
# endif
# endif
+# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+ i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_MATRIX_START, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix), TIMEOUT);
+ i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_SUSPEND_START, (void *)g_suspend_state, sizeof(i2c_buffer->led_suspend_state), TIMEOUT);
+# endif
# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT);
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[])
# endif
# endif
+# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+ memcpy((void*)i2c_buffer->led_matrix, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix));
+ memcpy((void*)i2c_buffer->led_suspend_state, (void *)g_suspend_state, sizeof(i2c_buffer->led_suspend_state));
+# endif
# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix));
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 {
# ifdef WPM_ENABLE
uint8_t current_wpm;
# endif
+# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+ led_eeconfig_t led_matrix;
+ bool led_suspend_state;
+# endif
# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
rgb_config_t rgb_matrix;
bool rgb_suspend_state;
@@ -368,6 +389,10 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[])
# endif
# endif
+# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+ serial_m2s_buffer.led_matrix = led_matrix_econfig;
+ serial_m2s_buffer.led_suspend_state = g_suspend_state;
+# endif
# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
serial_m2s_buffer.rgb_matrix = rgb_matrix_config;
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[])
# endif
# endif
+# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+ led_matrix_eeconfig = serial_m2s_buffer.led_matrix;
+ g_suspend_state = serial_m2s_buffer.led_suspend_state;
+# endif
# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
rgb_matrix_config = serial_m2s_buffer.rgb_matrix;
g_suspend_state = serial_m2s_buffer.rgb_suspend_state;