summaryrefslogtreecommitdiff
path: root/quantum/split_common
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/split_common')
-rw-r--r--quantum/split_common/post_config.h2
-rw-r--r--quantum/split_common/split_util.c20
-rw-r--r--quantum/split_common/transaction_id_define.h36
-rw-r--r--quantum/split_common/transactions.c94
-rw-r--r--quantum/split_common/transport.c30
-rw-r--r--quantum/split_common/transport.h60
6 files changed, 133 insertions, 109 deletions
diff --git a/quantum/split_common/post_config.h b/quantum/split_common/post_config.h
index a4c0a1956b..8f79beb6ed 100644
--- a/quantum/split_common/post_config.h
+++ b/quantum/split_common/post_config.h
@@ -5,6 +5,6 @@
5# endif 5# endif
6 6
7# ifndef F_SCL 7# ifndef F_SCL
8# define F_SCL 100000UL // SCL frequency 8# define F_SCL 100000UL // SCL frequency
9# endif 9# endif
10#endif 10#endif
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c
index 35f0a9d181..7d50adf758 100644
--- a/quantum/split_common/split_util.c
+++ b/quantum/split_common/split_util.c
@@ -43,14 +43,14 @@
43// Set to 0 to disable the disconnection check altogether. 43// Set to 0 to disable the disconnection check altogether.
44#ifndef SPLIT_MAX_CONNECTION_ERRORS 44#ifndef SPLIT_MAX_CONNECTION_ERRORS
45# define SPLIT_MAX_CONNECTION_ERRORS 10 45# define SPLIT_MAX_CONNECTION_ERRORS 10
46#endif // SPLIT_MAX_CONNECTION_ERRORS 46#endif // SPLIT_MAX_CONNECTION_ERRORS
47 47
48// How long (in milliseconds) to block all connection attempts after the communication has been flagged as disconnected. 48// How long (in milliseconds) to block all connection attempts after the communication has been flagged as disconnected.
49// One communication attempt will be allowed everytime this amount of time has passed since the last attempt. If that attempt succeeds, the communication is seen as working again. 49// One communication attempt will be allowed everytime this amount of time has passed since the last attempt. If that attempt succeeds, the communication is seen as working again.
50// Set to 0 to disable communication throttling while disconnected 50// Set to 0 to disable communication throttling while disconnected
51#ifndef SPLIT_CONNECTION_CHECK_TIMEOUT 51#ifndef SPLIT_CONNECTION_CHECK_TIMEOUT
52# define SPLIT_CONNECTION_CHECK_TIMEOUT 500 52# define SPLIT_CONNECTION_CHECK_TIMEOUT 500
53#endif // SPLIT_CONNECTION_CHECK_TIMEOUT 53#endif // SPLIT_CONNECTION_CHECK_TIMEOUT
54 54
55static uint8_t connection_errors = 0; 55static uint8_t connection_errors = 0;
56 56
@@ -68,7 +68,9 @@ static bool usbIsActive(void) {
68 return false; 68 return false;
69} 69}
70#else 70#else
71static inline bool usbIsActive(void) { return usb_vbus_state(); } 71static inline bool usbIsActive(void) {
72 return usb_vbus_state();
73}
72#endif 74#endif
73 75
74#ifdef SPLIT_HAND_MATRIX_GRID 76#ifdef SPLIT_HAND_MATRIX_GRID
@@ -83,7 +85,7 @@ static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) {
83 uint8_t pin_state = readPin(in_pin); 85 uint8_t pin_state = readPin(in_pin);
84 // Set out_pin to a setting that is less susceptible to noise. 86 // Set out_pin to a setting that is less susceptible to noise.
85 setPinInputHigh(out_pin); 87 setPinInputHigh(out_pin);
86 matrix_io_delay(); // Wait for the pull-up to go HIGH. 88 matrix_io_delay(); // Wait for the pull-up to go HIGH.
87 return pin_state; 89 return pin_state;
88} 90}
89#endif 91#endif
@@ -158,7 +160,9 @@ void split_post_init(void) {
158 } 160 }
159} 161}
160 162
161bool is_transport_connected(void) { return connection_errors < SPLIT_MAX_CONNECTION_ERRORS; } 163bool is_transport_connected(void) {
164 return connection_errors < SPLIT_MAX_CONNECTION_ERRORS;
165}
162 166
163bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { 167bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
164#if SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 168#if SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0
@@ -169,7 +173,7 @@ bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t sl
169 if (is_disconnected && timer_elapsed(connection_check_timer) < SPLIT_CONNECTION_CHECK_TIMEOUT) { 173 if (is_disconnected && timer_elapsed(connection_check_timer) < SPLIT_CONNECTION_CHECK_TIMEOUT) {
170 return false; 174 return false;
171 } 175 }
172#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 176#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0
173 177
174 __attribute__((unused)) bool okay = transport_master(master_matrix, slave_matrix); 178 __attribute__((unused)) bool okay = transport_master(master_matrix, slave_matrix);
175#if SPLIT_MAX_CONNECTION_ERRORS > 0 179#if SPLIT_MAX_CONNECTION_ERRORS > 0
@@ -186,10 +190,10 @@ bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t sl
186 return connected; 190 return connected;
187 } else if (is_disconnected) { 191 } else if (is_disconnected) {
188 dprintln("Target connected"); 192 dprintln("Target connected");
189# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0 193# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0
190 } 194 }
191 195
192 connection_errors = 0; 196 connection_errors = 0;
193#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 197#endif // SPLIT_MAX_CONNECTION_ERRORS > 0
194 return true; 198 return true;
195} 199}
diff --git a/quantum/split_common/transaction_id_define.h b/quantum/split_common/transaction_id_define.h
index aa71c3621e..761a8884f4 100644
--- a/quantum/split_common/transaction_id_define.h
+++ b/quantum/split_common/transaction_id_define.h
@@ -19,87 +19,87 @@
19enum serial_transaction_id { 19enum serial_transaction_id {
20#ifdef USE_I2C 20#ifdef USE_I2C
21 I2C_EXECUTE_CALLBACK, 21 I2C_EXECUTE_CALLBACK,
22#endif // USE_I2C 22#endif // USE_I2C
23 23
24 GET_SLAVE_MATRIX_CHECKSUM, 24 GET_SLAVE_MATRIX_CHECKSUM,
25 GET_SLAVE_MATRIX_DATA, 25 GET_SLAVE_MATRIX_DATA,
26 26
27#ifdef SPLIT_TRANSPORT_MIRROR 27#ifdef SPLIT_TRANSPORT_MIRROR
28 PUT_MASTER_MATRIX, 28 PUT_MASTER_MATRIX,
29#endif // SPLIT_TRANSPORT_MIRROR 29#endif // SPLIT_TRANSPORT_MIRROR
30 30
31#ifdef ENCODER_ENABLE 31#ifdef ENCODER_ENABLE
32 GET_ENCODERS_CHECKSUM, 32 GET_ENCODERS_CHECKSUM,
33 GET_ENCODERS_DATA, 33 GET_ENCODERS_DATA,
34#endif // ENCODER_ENABLE 34#endif // ENCODER_ENABLE
35 35
36#ifndef DISABLE_SYNC_TIMER 36#ifndef DISABLE_SYNC_TIMER
37 PUT_SYNC_TIMER, 37 PUT_SYNC_TIMER,
38#endif // DISABLE_SYNC_TIMER 38#endif // DISABLE_SYNC_TIMER
39 39
40#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) 40#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE)
41 PUT_LAYER_STATE, 41 PUT_LAYER_STATE,
42 PUT_DEFAULT_LAYER_STATE, 42 PUT_DEFAULT_LAYER_STATE,
43#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) 43#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE)
44 44
45#ifdef SPLIT_LED_STATE_ENABLE 45#ifdef SPLIT_LED_STATE_ENABLE
46 PUT_LED_STATE, 46 PUT_LED_STATE,
47#endif // SPLIT_LED_STATE_ENABLE 47#endif // SPLIT_LED_STATE_ENABLE
48 48
49#ifdef SPLIT_MODS_ENABLE 49#ifdef SPLIT_MODS_ENABLE
50 PUT_MODS, 50 PUT_MODS,
51#endif // SPLIT_MODS_ENABLE 51#endif // SPLIT_MODS_ENABLE
52 52
53#ifdef BACKLIGHT_ENABLE 53#ifdef BACKLIGHT_ENABLE
54 PUT_BACKLIGHT, 54 PUT_BACKLIGHT,
55#endif // BACKLIGHT_ENABLE 55#endif // BACKLIGHT_ENABLE
56 56
57#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 57#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
58 PUT_RGBLIGHT, 58 PUT_RGBLIGHT,
59#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 59#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
60 60
61#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) 61#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
62 PUT_LED_MATRIX, 62 PUT_LED_MATRIX,
63#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) 63#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
64 64
65#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) 65#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
66 PUT_RGB_MATRIX, 66 PUT_RGB_MATRIX,
67#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 67#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
68 68
69#if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) 69#if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE)
70 PUT_WPM, 70 PUT_WPM,
71#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) 71#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE)
72 72
73#if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) 73#if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE)
74 PUT_OLED, 74 PUT_OLED,
75#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) 75#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE)
76 76
77#if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) 77#if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE)
78 PUT_ST7565, 78 PUT_ST7565,
79#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) 79#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE)
80 80
81#if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) 81#if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE)
82 GET_POINTING_CHECKSUM, 82 GET_POINTING_CHECKSUM,
83 GET_POINTING_DATA, 83 GET_POINTING_DATA,
84 PUT_POINTING_CPI, 84 PUT_POINTING_CPI,
85#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) 85#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE)
86 86
87#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 87#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
88 PUT_RPC_INFO, 88 PUT_RPC_INFO,
89 PUT_RPC_REQ_DATA, 89 PUT_RPC_REQ_DATA,
90 EXECUTE_RPC, 90 EXECUTE_RPC,
91 GET_RPC_RESP_DATA, 91 GET_RPC_RESP_DATA,
92#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 92#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
93 93
94// keyboard-specific 94// keyboard-specific
95#ifdef SPLIT_TRANSACTION_IDS_KB 95#ifdef SPLIT_TRANSACTION_IDS_KB
96 SPLIT_TRANSACTION_IDS_KB, 96 SPLIT_TRANSACTION_IDS_KB,
97#endif // SPLIT_TRANSACTION_IDS_KB 97#endif // SPLIT_TRANSACTION_IDS_KB
98 98
99// user/keymap-specific 99// user/keymap-specific
100#ifdef SPLIT_TRANSACTION_IDS_USER 100#ifdef SPLIT_TRANSACTION_IDS_USER
101 SPLIT_TRANSACTION_IDS_USER, 101 SPLIT_TRANSACTION_IDS_USER,
102#endif // SPLIT_TRANSACTION_IDS_USER 102#endif // SPLIT_TRANSACTION_IDS_USER
103 103
104 NUM_TOTAL_TRANSACTIONS 104 NUM_TOTAL_TRANSACTIONS
105}; 105};
diff --git a/quantum/split_common/transactions.c b/quantum/split_common/transactions.c
index 4b059a2b8a..cffbccaeee 100644
--- a/quantum/split_common/transactions.c
+++ b/quantum/split_common/transactions.c
@@ -30,7 +30,7 @@
30 30
31#ifndef FORCED_SYNC_THROTTLE_MS 31#ifndef FORCED_SYNC_THROTTLE_MS
32# define FORCED_SYNC_THROTTLE_MS 100 32# define FORCED_SYNC_THROTTLE_MS 100
33#endif // FORCED_SYNC_THROTTLE_MS 33#endif // FORCED_SYNC_THROTTLE_MS
34 34
35#define sizeof_member(type, member) sizeof(((type *)NULL)->member) 35#define sizeof_member(type, member) sizeof(((type *)NULL)->member)
36 36
@@ -49,7 +49,7 @@
49// Forward-declare the RPC callback handlers 49// Forward-declare the RPC callback handlers
50void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); 50void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer);
51void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); 51void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer);
52#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 52#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
53 53
54//////////////////////////////////////////////////// 54////////////////////////////////////////////////////
55// Helpers 55// Helpers
@@ -63,7 +63,9 @@ static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_
63 } 63 }
64 } 64 }
65 bool this_okay = true; 65 bool this_okay = true;
66 ATOMIC_BLOCK_FORCEON { this_okay = handler(master_matrix, slave_matrix); }; 66 ATOMIC_BLOCK_FORCEON {
67 this_okay = handler(master_matrix, slave_matrix);
68 };
67 if (this_okay) return true; 69 if (this_okay) return true;
68 } 70 }
69 dprintf("Failed to execute %s\n", prefix); 71 dprintf("Failed to execute %s\n", prefix);
@@ -75,9 +77,11 @@ static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_
75 if (!transaction_handler_master(master_matrix, slave_matrix, #prefix, &prefix##_handlers_master)) return false; \ 77 if (!transaction_handler_master(master_matrix, slave_matrix, #prefix, &prefix##_handlers_master)) return false; \
76 } while (0) 78 } while (0)
77 79
78#define TRANSACTION_HANDLER_SLAVE(prefix) \ 80#define TRANSACTION_HANDLER_SLAVE(prefix) \
79 do { \ 81 do { \
80 ATOMIC_BLOCK_FORCEON { prefix##_handlers_slave(master_matrix, slave_matrix); }; \ 82 ATOMIC_BLOCK_FORCEON { \
83 prefix##_handlers_slave(master_matrix, slave_matrix); \
84 }; \
81 } while (0) 85 } while (0)
82 86
83inline static bool read_if_checksum_mismatch(int8_t trans_id_checksum, int8_t trans_id_retrieve, uint32_t *last_update, void *destination, const void *equiv_shmem, size_t length) { 87inline static bool read_if_checksum_mismatch(int8_t trans_id_checksum, int8_t trans_id_retrieve, uint32_t *last_update, void *destination, const void *equiv_shmem, size_t length) {
@@ -116,8 +120,8 @@ inline static bool send_if_data_mismatch(int8_t trans_id, uint32_t *last_update,
116 120
117static bool slave_matrix_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { 121static bool slave_matrix_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
118 static uint32_t last_update = 0; 122 static uint32_t last_update = 0;
119 static matrix_row_t last_matrix[(MATRIX_ROWS) / 2] = {0}; // last successfully-read matrix, so we can replicate if there are checksum errors 123 static matrix_row_t last_matrix[(MATRIX_ROWS) / 2] = {0}; // last successfully-read matrix, so we can replicate if there are checksum errors
120 matrix_row_t temp_matrix[(MATRIX_ROWS) / 2]; // holding area while we test whether or not checksum is correct 124 matrix_row_t temp_matrix[(MATRIX_ROWS) / 2]; // holding area while we test whether or not checksum is correct
121 125
122 bool okay = read_if_checksum_mismatch(GET_SLAVE_MATRIX_CHECKSUM, GET_SLAVE_MATRIX_DATA, &last_update, temp_matrix, split_shmem->smatrix.matrix, sizeof(split_shmem->smatrix.matrix)); 126 bool okay = read_if_checksum_mismatch(GET_SLAVE_MATRIX_CHECKSUM, GET_SLAVE_MATRIX_DATA, &last_update, temp_matrix, split_shmem->smatrix.matrix, sizeof(split_shmem->smatrix.matrix));
123 if (okay) { 127 if (okay) {
@@ -161,13 +165,13 @@ static void master_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_ro
161# define TRANSACTIONS_MASTER_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(master_matrix) 165# define TRANSACTIONS_MASTER_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(master_matrix)
162# define TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS [PUT_MASTER_MATRIX] = trans_initiator2target_initializer(mmatrix.matrix), 166# define TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS [PUT_MASTER_MATRIX] = trans_initiator2target_initializer(mmatrix.matrix),
163 167
164#else // SPLIT_TRANSPORT_MIRROR 168#else // SPLIT_TRANSPORT_MIRROR
165 169
166# define TRANSACTIONS_MASTER_MATRIX_MASTER() 170# define TRANSACTIONS_MASTER_MATRIX_MASTER()
167# define TRANSACTIONS_MASTER_MATRIX_SLAVE() 171# define TRANSACTIONS_MASTER_MATRIX_SLAVE()
168# define TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS 172# define TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS
169 173
170#endif // SPLIT_TRANSPORT_MIRROR 174#endif // SPLIT_TRANSPORT_MIRROR
171 175
172//////////////////////////////////////////////////// 176////////////////////////////////////////////////////
173// Encoders 177// Encoders
@@ -200,13 +204,13 @@ static void encoder_handlers_slave(matrix_row_t master_matrix[], matrix_row_t sl
200 [GET_ENCODERS_DATA] = trans_target2initiator_initializer(encoders.state), 204 [GET_ENCODERS_DATA] = trans_target2initiator_initializer(encoders.state),
201// clang-format on 205// clang-format on
202 206
203#else // ENCODER_ENABLE 207#else // ENCODER_ENABLE
204 208
205# define TRANSACTIONS_ENCODERS_MASTER() 209# define TRANSACTIONS_ENCODERS_MASTER()
206# define TRANSACTIONS_ENCODERS_SLAVE() 210# define TRANSACTIONS_ENCODERS_SLAVE()
207# define TRANSACTIONS_ENCODERS_REGISTRATIONS 211# define TRANSACTIONS_ENCODERS_REGISTRATIONS
208 212
209#endif // ENCODER_ENABLE 213#endif // ENCODER_ENABLE
210 214
211//////////////////////////////////////////////////// 215////////////////////////////////////////////////////
212// Sync timer 216// Sync timer
@@ -239,13 +243,13 @@ static void sync_timer_handlers_slave(matrix_row_t master_matrix[], matrix_row_t
239# define TRANSACTIONS_SYNC_TIMER_SLAVE() TRANSACTION_HANDLER_SLAVE(sync_timer) 243# define TRANSACTIONS_SYNC_TIMER_SLAVE() TRANSACTION_HANDLER_SLAVE(sync_timer)
240# define TRANSACTIONS_SYNC_TIMER_REGISTRATIONS [PUT_SYNC_TIMER] = trans_initiator2target_initializer(sync_timer), 244# define TRANSACTIONS_SYNC_TIMER_REGISTRATIONS [PUT_SYNC_TIMER] = trans_initiator2target_initializer(sync_timer),
241 245
242#else // DISABLE_SYNC_TIMER 246#else // DISABLE_SYNC_TIMER
243 247
244# define TRANSACTIONS_SYNC_TIMER_MASTER() 248# define TRANSACTIONS_SYNC_TIMER_MASTER()
245# define TRANSACTIONS_SYNC_TIMER_SLAVE() 249# define TRANSACTIONS_SYNC_TIMER_SLAVE()
246# define TRANSACTIONS_SYNC_TIMER_REGISTRATIONS 250# define TRANSACTIONS_SYNC_TIMER_REGISTRATIONS
247 251
248#endif // DISABLE_SYNC_TIMER 252#endif // DISABLE_SYNC_TIMER
249 253
250//////////////////////////////////////////////////// 254////////////////////////////////////////////////////
251// Layer state 255// Layer state
@@ -276,13 +280,13 @@ static void layer_state_handlers_slave(matrix_row_t master_matrix[], matrix_row_
276 [PUT_DEFAULT_LAYER_STATE] = trans_initiator2target_initializer(layers.default_layer_state), 280 [PUT_DEFAULT_LAYER_STATE] = trans_initiator2target_initializer(layers.default_layer_state),
277// clang-format on 281// clang-format on
278 282
279#else // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) 283#else // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE)
280 284
281# define TRANSACTIONS_LAYER_STATE_MASTER() 285# define TRANSACTIONS_LAYER_STATE_MASTER()
282# define TRANSACTIONS_LAYER_STATE_SLAVE() 286# define TRANSACTIONS_LAYER_STATE_SLAVE()
283# define TRANSACTIONS_LAYER_STATE_REGISTRATIONS 287# define TRANSACTIONS_LAYER_STATE_REGISTRATIONS
284 288
285#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) 289#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE)
286 290
287//////////////////////////////////////////////////// 291////////////////////////////////////////////////////
288// LED state 292// LED state
@@ -304,13 +308,13 @@ static void led_state_handlers_slave(matrix_row_t master_matrix[], matrix_row_t
304# define TRANSACTIONS_LED_STATE_SLAVE() TRANSACTION_HANDLER_SLAVE(led_state) 308# define TRANSACTIONS_LED_STATE_SLAVE() TRANSACTION_HANDLER_SLAVE(led_state)
305# define TRANSACTIONS_LED_STATE_REGISTRATIONS [PUT_LED_STATE] = trans_initiator2target_initializer(led_state), 309# define TRANSACTIONS_LED_STATE_REGISTRATIONS [PUT_LED_STATE] = trans_initiator2target_initializer(led_state),
306 310
307#else // SPLIT_LED_STATE_ENABLE 311#else // SPLIT_LED_STATE_ENABLE
308 312
309# define TRANSACTIONS_LED_STATE_MASTER() 313# define TRANSACTIONS_LED_STATE_MASTER()
310# define TRANSACTIONS_LED_STATE_SLAVE() 314# define TRANSACTIONS_LED_STATE_SLAVE()
311# define TRANSACTIONS_LED_STATE_REGISTRATIONS 315# define TRANSACTIONS_LED_STATE_REGISTRATIONS
312 316
313#endif // SPLIT_LED_STATE_ENABLE 317#endif // SPLIT_LED_STATE_ENABLE
314 318
315//////////////////////////////////////////////////// 319////////////////////////////////////////////////////
316// Mods 320// Mods
@@ -336,7 +340,7 @@ static bool mods_handlers_master(matrix_row_t master_matrix[], matrix_row_t slav
336 if (!mods_need_sync && new_mods.oneshot_mods != split_shmem->mods.oneshot_mods) { 340 if (!mods_need_sync && new_mods.oneshot_mods != split_shmem->mods.oneshot_mods) {
337 mods_need_sync = true; 341 mods_need_sync = true;
338 } 342 }
339# endif // NO_ACTION_ONESHOT 343# endif // NO_ACTION_ONESHOT
340 344
341 bool okay = true; 345 bool okay = true;
342 if (mods_need_sync) { 346 if (mods_need_sync) {
@@ -361,13 +365,13 @@ static void mods_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave
361# define TRANSACTIONS_MODS_SLAVE() TRANSACTION_HANDLER_SLAVE(mods) 365# define TRANSACTIONS_MODS_SLAVE() TRANSACTION_HANDLER_SLAVE(mods)
362# define TRANSACTIONS_MODS_REGISTRATIONS [PUT_MODS] = trans_initiator2target_initializer(mods), 366# define TRANSACTIONS_MODS_REGISTRATIONS [PUT_MODS] = trans_initiator2target_initializer(mods),
363 367
364#else // SPLIT_MODS_ENABLE 368#else // SPLIT_MODS_ENABLE
365 369
366# define TRANSACTIONS_MODS_MASTER() 370# define TRANSACTIONS_MODS_MASTER()
367# define TRANSACTIONS_MODS_SLAVE() 371# define TRANSACTIONS_MODS_SLAVE()
368# define TRANSACTIONS_MODS_REGISTRATIONS 372# define TRANSACTIONS_MODS_REGISTRATIONS
369 373
370#endif // SPLIT_MODS_ENABLE 374#endif // SPLIT_MODS_ENABLE
371 375
372//////////////////////////////////////////////////// 376////////////////////////////////////////////////////
373// Backlight 377// Backlight
@@ -380,19 +384,21 @@ static bool backlight_handlers_master(matrix_row_t master_matrix[], matrix_row_t
380 return send_if_condition(PUT_BACKLIGHT, &last_update, (level != split_shmem->backlight_level), &level, sizeof(level)); 384 return send_if_condition(PUT_BACKLIGHT, &last_update, (level != split_shmem->backlight_level), &level, sizeof(level));
381} 385}
382 386
383static void backlight_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { backlight_set(split_shmem->backlight_level); } 387static void backlight_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
388 backlight_set(split_shmem->backlight_level);
389}
384 390
385# define TRANSACTIONS_BACKLIGHT_MASTER() TRANSACTION_HANDLER_MASTER(backlight) 391# define TRANSACTIONS_BACKLIGHT_MASTER() TRANSACTION_HANDLER_MASTER(backlight)
386# define TRANSACTIONS_BACKLIGHT_SLAVE() TRANSACTION_HANDLER_SLAVE(backlight) 392# define TRANSACTIONS_BACKLIGHT_SLAVE() TRANSACTION_HANDLER_SLAVE(backlight)
387# define TRANSACTIONS_BACKLIGHT_REGISTRATIONS [PUT_BACKLIGHT] = trans_initiator2target_initializer(backlight_level), 393# define TRANSACTIONS_BACKLIGHT_REGISTRATIONS [PUT_BACKLIGHT] = trans_initiator2target_initializer(backlight_level),
388 394
389#else // BACKLIGHT_ENABLE 395#else // BACKLIGHT_ENABLE
390 396
391# define TRANSACTIONS_BACKLIGHT_MASTER() 397# define TRANSACTIONS_BACKLIGHT_MASTER()
392# define TRANSACTIONS_BACKLIGHT_SLAVE() 398# define TRANSACTIONS_BACKLIGHT_SLAVE()
393# define TRANSACTIONS_BACKLIGHT_REGISTRATIONS 399# define TRANSACTIONS_BACKLIGHT_REGISTRATIONS
394 400
395#endif // BACKLIGHT_ENABLE 401#endif // BACKLIGHT_ENABLE
396 402
397//////////////////////////////////////////////////// 403////////////////////////////////////////////////////
398// RGBLIGHT 404// RGBLIGHT
@@ -423,13 +429,13 @@ static void rgblight_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s
423# define TRANSACTIONS_RGBLIGHT_SLAVE() TRANSACTION_HANDLER_SLAVE(rgblight) 429# define TRANSACTIONS_RGBLIGHT_SLAVE() TRANSACTION_HANDLER_SLAVE(rgblight)
424# define TRANSACTIONS_RGBLIGHT_REGISTRATIONS [PUT_RGBLIGHT] = trans_initiator2target_initializer(rgblight_sync), 430# define TRANSACTIONS_RGBLIGHT_REGISTRATIONS [PUT_RGBLIGHT] = trans_initiator2target_initializer(rgblight_sync),
425 431
426#else // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 432#else // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
427 433
428# define TRANSACTIONS_RGBLIGHT_MASTER() 434# define TRANSACTIONS_RGBLIGHT_MASTER()
429# define TRANSACTIONS_RGBLIGHT_SLAVE() 435# define TRANSACTIONS_RGBLIGHT_SLAVE()
430# define TRANSACTIONS_RGBLIGHT_REGISTRATIONS 436# define TRANSACTIONS_RGBLIGHT_REGISTRATIONS
431 437
432#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 438#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
433 439
434//////////////////////////////////////////////////// 440////////////////////////////////////////////////////
435// LED Matrix 441// LED Matrix
@@ -453,13 +459,13 @@ static void led_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_row_t
453# define TRANSACTIONS_LED_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(led_matrix) 459# define TRANSACTIONS_LED_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(led_matrix)
454# define TRANSACTIONS_LED_MATRIX_REGISTRATIONS [PUT_LED_MATRIX] = trans_initiator2target_initializer(led_matrix_sync), 460# define TRANSACTIONS_LED_MATRIX_REGISTRATIONS [PUT_LED_MATRIX] = trans_initiator2target_initializer(led_matrix_sync),
455 461
456#else // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) 462#else // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
457 463
458# define TRANSACTIONS_LED_MATRIX_MASTER() 464# define TRANSACTIONS_LED_MATRIX_MASTER()
459# define TRANSACTIONS_LED_MATRIX_SLAVE() 465# define TRANSACTIONS_LED_MATRIX_SLAVE()
460# define TRANSACTIONS_LED_MATRIX_REGISTRATIONS 466# define TRANSACTIONS_LED_MATRIX_REGISTRATIONS
461 467
462#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) 468#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
463 469
464//////////////////////////////////////////////////// 470////////////////////////////////////////////////////
465// RGB Matrix 471// RGB Matrix
@@ -483,13 +489,13 @@ static void rgb_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_row_t
483# define TRANSACTIONS_RGB_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(rgb_matrix) 489# define TRANSACTIONS_RGB_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(rgb_matrix)
484# define TRANSACTIONS_RGB_MATRIX_REGISTRATIONS [PUT_RGB_MATRIX] = trans_initiator2target_initializer(rgb_matrix_sync), 490# define TRANSACTIONS_RGB_MATRIX_REGISTRATIONS [PUT_RGB_MATRIX] = trans_initiator2target_initializer(rgb_matrix_sync),
485 491
486#else // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) 492#else // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
487 493
488# define TRANSACTIONS_RGB_MATRIX_MASTER() 494# define TRANSACTIONS_RGB_MATRIX_MASTER()
489# define TRANSACTIONS_RGB_MATRIX_SLAVE() 495# define TRANSACTIONS_RGB_MATRIX_SLAVE()
490# define TRANSACTIONS_RGB_MATRIX_REGISTRATIONS 496# define TRANSACTIONS_RGB_MATRIX_REGISTRATIONS
491 497
492#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) 498#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
493 499
494//////////////////////////////////////////////////// 500////////////////////////////////////////////////////
495// WPM 501// WPM
@@ -502,19 +508,21 @@ static bool wpm_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave
502 return send_if_condition(PUT_WPM, &last_update, (current_wpm != split_shmem->current_wpm), &current_wpm, sizeof(current_wpm)); 508 return send_if_condition(PUT_WPM, &last_update, (current_wpm != split_shmem->current_wpm), &current_wpm, sizeof(current_wpm));
503} 509}
504 510
505static void wpm_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { set_current_wpm(split_shmem->current_wpm); } 511static void wpm_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
512 set_current_wpm(split_shmem->current_wpm);
513}
506 514
507# define TRANSACTIONS_WPM_MASTER() TRANSACTION_HANDLER_MASTER(wpm) 515# define TRANSACTIONS_WPM_MASTER() TRANSACTION_HANDLER_MASTER(wpm)
508# define TRANSACTIONS_WPM_SLAVE() TRANSACTION_HANDLER_SLAVE(wpm) 516# define TRANSACTIONS_WPM_SLAVE() TRANSACTION_HANDLER_SLAVE(wpm)
509# define TRANSACTIONS_WPM_REGISTRATIONS [PUT_WPM] = trans_initiator2target_initializer(current_wpm), 517# define TRANSACTIONS_WPM_REGISTRATIONS [PUT_WPM] = trans_initiator2target_initializer(current_wpm),
510 518
511#else // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) 519#else // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE)
512 520
513# define TRANSACTIONS_WPM_MASTER() 521# define TRANSACTIONS_WPM_MASTER()
514# define TRANSACTIONS_WPM_SLAVE() 522# define TRANSACTIONS_WPM_SLAVE()
515# define TRANSACTIONS_WPM_REGISTRATIONS 523# define TRANSACTIONS_WPM_REGISTRATIONS
516 524
517#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) 525#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE)
518 526
519//////////////////////////////////////////////////// 527////////////////////////////////////////////////////
520// OLED 528// OLED
@@ -539,13 +547,13 @@ static void oled_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave
539# define TRANSACTIONS_OLED_SLAVE() TRANSACTION_HANDLER_SLAVE(oled) 547# define TRANSACTIONS_OLED_SLAVE() TRANSACTION_HANDLER_SLAVE(oled)
540# define TRANSACTIONS_OLED_REGISTRATIONS [PUT_OLED] = trans_initiator2target_initializer(current_oled_state), 548# define TRANSACTIONS_OLED_REGISTRATIONS [PUT_OLED] = trans_initiator2target_initializer(current_oled_state),
541 549
542#else // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) 550#else // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE)
543 551
544# define TRANSACTIONS_OLED_MASTER() 552# define TRANSACTIONS_OLED_MASTER()
545# define TRANSACTIONS_OLED_SLAVE() 553# define TRANSACTIONS_OLED_SLAVE()
546# define TRANSACTIONS_OLED_REGISTRATIONS 554# define TRANSACTIONS_OLED_REGISTRATIONS
547 555
548#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) 556#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE)
549 557
550//////////////////////////////////////////////////// 558////////////////////////////////////////////////////
551// ST7565 559// ST7565
@@ -570,13 +578,13 @@ static void st7565_handlers_slave(matrix_row_t master_matrix[], matrix_row_t sla
570# define TRANSACTIONS_ST7565_SLAVE() TRANSACTION_HANDLER_SLAVE(st7565) 578# define TRANSACTIONS_ST7565_SLAVE() TRANSACTION_HANDLER_SLAVE(st7565)
571# define TRANSACTIONS_ST7565_REGISTRATIONS [PUT_ST7565] = trans_initiator2target_initializer(current_st7565_state), 579# define TRANSACTIONS_ST7565_REGISTRATIONS [PUT_ST7565] = trans_initiator2target_initializer(current_st7565_state),
572 580
573#else // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) 581#else // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE)
574 582
575# define TRANSACTIONS_ST7565_MASTER() 583# define TRANSACTIONS_ST7565_MASTER()
576# define TRANSACTIONS_ST7565_SLAVE() 584# define TRANSACTIONS_ST7565_SLAVE()
577# define TRANSACTIONS_ST7565_REGISTRATIONS 585# define TRANSACTIONS_ST7565_REGISTRATIONS
578 586
579#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) 587#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE)
580 588
581//////////////////////////////////////////////////// 589////////////////////////////////////////////////////
582// POINTING 590// POINTING
@@ -631,7 +639,7 @@ static void pointing_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s
631 } 639 }
632 last_exec = timer_read32(); 640 last_exec = timer_read32();
633# endif 641# endif
634 temp_cpi = !pointing_device_driver.get_cpi ? 0 : pointing_device_driver.get_cpi(); // check for NULL 642 temp_cpi = !pointing_device_driver.get_cpi ? 0 : pointing_device_driver.get_cpi(); // check for NULL
635 if (split_shmem->pointing.cpi && memcmp(&split_shmem->pointing.cpi, &temp_cpi, sizeof(temp_cpi)) != 0) { 643 if (split_shmem->pointing.cpi && memcmp(&split_shmem->pointing.cpi, &temp_cpi, sizeof(temp_cpi)) != 0) {
636 if (pointing_device_driver.set_cpi) { 644 if (pointing_device_driver.set_cpi) {
637 pointing_device_driver.set_cpi(split_shmem->pointing.cpi); 645 pointing_device_driver.set_cpi(split_shmem->pointing.cpi);
@@ -648,13 +656,13 @@ static void pointing_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s
648# define TRANSACTIONS_POINTING_SLAVE() TRANSACTION_HANDLER_SLAVE(pointing) 656# define TRANSACTIONS_POINTING_SLAVE() TRANSACTION_HANDLER_SLAVE(pointing)
649# define TRANSACTIONS_POINTING_REGISTRATIONS [GET_POINTING_CHECKSUM] = trans_target2initiator_initializer(pointing.checksum), [GET_POINTING_DATA] = trans_target2initiator_initializer(pointing.report), [PUT_POINTING_CPI] = trans_initiator2target_initializer(pointing.cpi), 657# define TRANSACTIONS_POINTING_REGISTRATIONS [GET_POINTING_CHECKSUM] = trans_target2initiator_initializer(pointing.checksum), [GET_POINTING_DATA] = trans_target2initiator_initializer(pointing.report), [PUT_POINTING_CPI] = trans_initiator2target_initializer(pointing.cpi),
650 658
651#else // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) 659#else // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE)
652 660
653# define TRANSACTIONS_POINTING_MASTER() 661# define TRANSACTIONS_POINTING_MASTER()
654# define TRANSACTIONS_POINTING_SLAVE() 662# define TRANSACTIONS_POINTING_SLAVE()
655# define TRANSACTIONS_POINTING_REGISTRATIONS 663# define TRANSACTIONS_POINTING_REGISTRATIONS
656 664
657#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) 665#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE)
658 666
659//////////////////////////////////////////////////// 667////////////////////////////////////////////////////
660 668
@@ -664,7 +672,7 @@ split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = {
664 672
665#ifdef USE_I2C 673#ifdef USE_I2C
666 [I2C_EXECUTE_CALLBACK] = trans_initiator2target_initializer(transaction_id), 674 [I2C_EXECUTE_CALLBACK] = trans_initiator2target_initializer(transaction_id),
667#endif // USE_I2C 675#endif // USE_I2C
668 676
669 // clang-format off 677 // clang-format off
670 TRANSACTIONS_SLAVE_MATRIX_REGISTRATIONS 678 TRANSACTIONS_SLAVE_MATRIX_REGISTRATIONS
@@ -689,7 +697,7 @@ split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = {
689 [PUT_RPC_REQ_DATA] = trans_initiator2target_initializer(rpc_m2s_buffer), 697 [PUT_RPC_REQ_DATA] = trans_initiator2target_initializer(rpc_m2s_buffer),
690 [EXECUTE_RPC] = trans_initiator2target_initializer_cb(rpc_info.transaction_id, slave_rpc_exec_callback), 698 [EXECUTE_RPC] = trans_initiator2target_initializer_cb(rpc_info.transaction_id, slave_rpc_exec_callback),
691 [GET_RPC_RESP_DATA] = trans_target2initiator_initializer(rpc_s2m_buffer), 699 [GET_RPC_RESP_DATA] = trans_target2initiator_initializer(rpc_s2m_buffer),
692#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 700#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
693}; 701};
694 702
695bool transactions_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { 703bool transactions_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
@@ -800,4 +808,4 @@ void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *i
800 } 808 }
801} 809}
802 810
803#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 811#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c
index 060ba8a927..aade3c98d7 100644
--- a/quantum/split_common/transport.c
+++ b/quantum/split_common/transport.c
@@ -26,7 +26,7 @@
26 26
27# ifndef SLAVE_I2C_TIMEOUT 27# ifndef SLAVE_I2C_TIMEOUT
28# define SLAVE_I2C_TIMEOUT 100 28# define SLAVE_I2C_TIMEOUT 100
29# endif // SLAVE_I2C_TIMEOUT 29# endif // SLAVE_I2C_TIMEOUT
30 30
31# ifndef SLAVE_I2C_ADDRESS 31# ifndef SLAVE_I2C_ADDRESS
32# define SLAVE_I2C_ADDRESS 0x32 32# define SLAVE_I2C_ADDRESS 0x32
@@ -40,8 +40,12 @@ _Static_assert(sizeof(split_shared_memory_t) <= I2C_SLAVE_REG_COUNT, "split_shar
40 40
41split_shared_memory_t *const split_shmem = (split_shared_memory_t *)i2c_slave_reg; 41split_shared_memory_t *const split_shmem = (split_shared_memory_t *)i2c_slave_reg;
42 42
43void transport_master_init(void) { i2c_init(); } 43void transport_master_init(void) {
44void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); } 44 i2c_init();
45}
46void transport_slave_init(void) {
47 i2c_slave_init(SLAVE_I2C_ADDRESS);
48}
45 49
46i2c_status_t transport_trigger_callback(int8_t id) { 50i2c_status_t transport_trigger_callback(int8_t id) {
47 // If there's no callback, indicate that we were successful 51 // If there's no callback, indicate that we were successful
@@ -82,15 +86,19 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf,
82 return true; 86 return true;
83} 87}
84 88
85#else // USE_I2C 89#else // USE_I2C
86 90
87# include "serial.h" 91# include "serial.h"
88 92
89static split_shared_memory_t shared_memory; 93static split_shared_memory_t shared_memory;
90split_shared_memory_t *const split_shmem = &shared_memory; 94split_shared_memory_t *const split_shmem = &shared_memory;
91 95
92void transport_master_init(void) { soft_serial_initiator_init(); } 96void transport_master_init(void) {
93void transport_slave_init(void) { soft_serial_target_init(); } 97 soft_serial_initiator_init();
98}
99void transport_slave_init(void) {
100 soft_serial_target_init();
101}
94 102
95bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, uint16_t initiator2target_length, void *target2initiator_buf, uint16_t target2initiator_length) { 103bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, uint16_t initiator2target_length, void *target2initiator_buf, uint16_t target2initiator_length) {
96 split_transaction_desc_t *trans = &split_transaction_table[id]; 104 split_transaction_desc_t *trans = &split_transaction_table[id];
@@ -111,8 +119,12 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf,
111 return true; 119 return true;
112} 120}
113 121
114#endif // USE_I2C 122#endif // USE_I2C
115 123
116bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { return transactions_master(master_matrix, slave_matrix); } 124bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
125 return transactions_master(master_matrix, slave_matrix);
126}
117 127
118void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { transactions_slave(master_matrix, slave_matrix); } 128void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
129 transactions_slave(master_matrix, slave_matrix);
130}
diff --git a/quantum/split_common/transport.h b/quantum/split_common/transport.h
index 31b804908b..26bd136728 100644
--- a/quantum/split_common/transport.h
+++ b/quantum/split_common/transport.h
@@ -25,11 +25,11 @@
25 25
26#ifndef RPC_M2S_BUFFER_SIZE 26#ifndef RPC_M2S_BUFFER_SIZE
27# define RPC_M2S_BUFFER_SIZE 32 27# define RPC_M2S_BUFFER_SIZE 32
28#endif // RPC_M2S_BUFFER_SIZE 28#endif // RPC_M2S_BUFFER_SIZE
29 29
30#ifndef RPC_S2M_BUFFER_SIZE 30#ifndef RPC_S2M_BUFFER_SIZE
31# define RPC_S2M_BUFFER_SIZE 32 31# define RPC_S2M_BUFFER_SIZE 32
32#endif // RPC_S2M_BUFFER_SIZE 32#endif // RPC_S2M_BUFFER_SIZE
33 33
34void transport_master_init(void); 34void transport_master_init(void);
35void transport_slave_init(void); 35void transport_slave_init(void);
@@ -43,15 +43,15 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf,
43#ifdef ENCODER_ENABLE 43#ifdef ENCODER_ENABLE
44# include "encoder.h" 44# include "encoder.h"
45# define NUMBER_OF_ENCODERS (sizeof((pin_t[])ENCODERS_PAD_A) / sizeof(pin_t)) 45# define NUMBER_OF_ENCODERS (sizeof((pin_t[])ENCODERS_PAD_A) / sizeof(pin_t))
46#endif // ENCODER_ENABLE 46#endif // ENCODER_ENABLE
47 47
48#ifdef BACKLIGHT_ENABLE 48#ifdef BACKLIGHT_ENABLE
49# include "backlight.h" 49# include "backlight.h"
50#endif // BACKLIGHT_ENABLE 50#endif // BACKLIGHT_ENABLE
51 51
52#ifdef RGBLIGHT_ENABLE 52#ifdef RGBLIGHT_ENABLE
53# include "rgblight.h" 53# include "rgblight.h"
54#endif // RGBLIGHT_ENABLE 54#endif // RGBLIGHT_ENABLE
55 55
56typedef struct _split_slave_matrix_sync_t { 56typedef struct _split_slave_matrix_sync_t {
57 uint8_t checksum; 57 uint8_t checksum;
@@ -62,21 +62,21 @@ typedef struct _split_slave_matrix_sync_t {
62typedef struct _split_master_matrix_sync_t { 62typedef struct _split_master_matrix_sync_t {
63 matrix_row_t matrix[(MATRIX_ROWS) / 2]; 63 matrix_row_t matrix[(MATRIX_ROWS) / 2];
64} split_master_matrix_sync_t; 64} split_master_matrix_sync_t;
65#endif // SPLIT_TRANSPORT_MIRROR 65#endif // SPLIT_TRANSPORT_MIRROR
66 66
67#ifdef ENCODER_ENABLE 67#ifdef ENCODER_ENABLE
68typedef struct _split_slave_encoder_sync_t { 68typedef struct _split_slave_encoder_sync_t {
69 uint8_t checksum; 69 uint8_t checksum;
70 uint8_t state[NUMBER_OF_ENCODERS]; 70 uint8_t state[NUMBER_OF_ENCODERS];
71} split_slave_encoder_sync_t; 71} split_slave_encoder_sync_t;
72#endif // ENCODER_ENABLE 72#endif // ENCODER_ENABLE
73 73
74#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) 74#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE)
75typedef struct _split_layers_sync_t { 75typedef struct _split_layers_sync_t {
76 layer_state_t layer_state; 76 layer_state_t layer_state;
77 layer_state_t default_layer_state; 77 layer_state_t default_layer_state;
78} split_layers_sync_t; 78} split_layers_sync_t;
79#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) 79#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE)
80 80
81#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) 81#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
82# include "led_matrix.h" 82# include "led_matrix.h"
@@ -85,7 +85,7 @@ typedef struct _led_matrix_sync_t {
85 led_eeconfig_t led_matrix; 85 led_eeconfig_t led_matrix;
86 bool led_suspend_state; 86 bool led_suspend_state;
87} led_matrix_sync_t; 87} led_matrix_sync_t;
88#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) 88#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
89 89
90#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) 90#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
91# include "rgb_matrix.h" 91# include "rgb_matrix.h"
@@ -94,7 +94,7 @@ typedef struct _rgb_matrix_sync_t {
94 rgb_config_t rgb_matrix; 94 rgb_config_t rgb_matrix;
95 bool rgb_suspend_state; 95 bool rgb_suspend_state;
96} rgb_matrix_sync_t; 96} rgb_matrix_sync_t;
97#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) 97#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
98 98
99#ifdef SPLIT_MODS_ENABLE 99#ifdef SPLIT_MODS_ENABLE
100typedef struct _split_mods_sync_t { 100typedef struct _split_mods_sync_t {
@@ -102,9 +102,9 @@ typedef struct _split_mods_sync_t {
102 uint8_t weak_mods; 102 uint8_t weak_mods;
103# ifndef NO_ACTION_ONESHOT 103# ifndef NO_ACTION_ONESHOT
104 uint8_t oneshot_mods; 104 uint8_t oneshot_mods;
105# endif // NO_ACTION_ONESHOT 105# endif // NO_ACTION_ONESHOT
106} split_mods_sync_t; 106} split_mods_sync_t;
107#endif // SPLIT_MODS_ENABLE 107#endif // SPLIT_MODS_ENABLE
108 108
109#if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) 109#if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE)
110# include "pointing_device.h" 110# include "pointing_device.h"
@@ -113,7 +113,7 @@ typedef struct _split_slave_pointing_sync_t {
113 report_mouse_t report; 113 report_mouse_t report;
114 uint16_t cpi; 114 uint16_t cpi;
115} split_slave_pointing_sync_t; 115} split_slave_pointing_sync_t;
116#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) 116#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE)
117 117
118#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 118#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
119typedef struct _rpc_sync_info_t { 119typedef struct _rpc_sync_info_t {
@@ -121,76 +121,76 @@ typedef struct _rpc_sync_info_t {
121 uint8_t m2s_length; 121 uint8_t m2s_length;
122 uint8_t s2m_length; 122 uint8_t s2m_length;
123} rpc_sync_info_t; 123} rpc_sync_info_t;
124#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 124#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
125 125
126typedef struct _split_shared_memory_t { 126typedef struct _split_shared_memory_t {
127#ifdef USE_I2C 127#ifdef USE_I2C
128 int8_t transaction_id; 128 int8_t transaction_id;
129#endif // USE_I2C 129#endif // USE_I2C
130 130
131 split_slave_matrix_sync_t smatrix; 131 split_slave_matrix_sync_t smatrix;
132 132
133#ifdef SPLIT_TRANSPORT_MIRROR 133#ifdef SPLIT_TRANSPORT_MIRROR
134 split_master_matrix_sync_t mmatrix; 134 split_master_matrix_sync_t mmatrix;
135#endif // SPLIT_TRANSPORT_MIRROR 135#endif // SPLIT_TRANSPORT_MIRROR
136 136
137#ifdef ENCODER_ENABLE 137#ifdef ENCODER_ENABLE
138 split_slave_encoder_sync_t encoders; 138 split_slave_encoder_sync_t encoders;
139#endif // ENCODER_ENABLE 139#endif // ENCODER_ENABLE
140 140
141#ifndef DISABLE_SYNC_TIMER 141#ifndef DISABLE_SYNC_TIMER
142 uint32_t sync_timer; 142 uint32_t sync_timer;
143#endif // DISABLE_SYNC_TIMER 143#endif // DISABLE_SYNC_TIMER
144 144
145#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) 145#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE)
146 split_layers_sync_t layers; 146 split_layers_sync_t layers;
147#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) 147#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE)
148 148
149#ifdef SPLIT_LED_STATE_ENABLE 149#ifdef SPLIT_LED_STATE_ENABLE
150 uint8_t led_state; 150 uint8_t led_state;
151#endif // SPLIT_LED_STATE_ENABLE 151#endif // SPLIT_LED_STATE_ENABLE
152 152
153#ifdef SPLIT_MODS_ENABLE 153#ifdef SPLIT_MODS_ENABLE
154 split_mods_sync_t mods; 154 split_mods_sync_t mods;
155#endif // SPLIT_MODS_ENABLE 155#endif // SPLIT_MODS_ENABLE
156 156
157#ifdef BACKLIGHT_ENABLE 157#ifdef BACKLIGHT_ENABLE
158 uint8_t backlight_level; 158 uint8_t backlight_level;
159#endif // BACKLIGHT_ENABLE 159#endif // BACKLIGHT_ENABLE
160 160
161#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 161#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
162 rgblight_syncinfo_t rgblight_sync; 162 rgblight_syncinfo_t rgblight_sync;
163#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 163#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
164 164
165#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) 165#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
166 led_matrix_sync_t led_matrix_sync; 166 led_matrix_sync_t led_matrix_sync;
167#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) 167#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
168 168
169#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) 169#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
170 rgb_matrix_sync_t rgb_matrix_sync; 170 rgb_matrix_sync_t rgb_matrix_sync;
171#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) 171#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
172 172
173#if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) 173#if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE)
174 uint8_t current_wpm; 174 uint8_t current_wpm;
175#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) 175#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE)
176 176
177#if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) 177#if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE)
178 uint8_t current_oled_state; 178 uint8_t current_oled_state;
179#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) 179#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE)
180 180
181#if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) 181#if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE)
182 uint8_t current_st7565_state; 182 uint8_t current_st7565_state;
183#endif // ST7565_ENABLE(OLED_ENABLE) && defined(SPLIT_ST7565_ENABLE) 183#endif // ST7565_ENABLE(OLED_ENABLE) && defined(SPLIT_ST7565_ENABLE)
184 184
185#if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) 185#if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE)
186 split_slave_pointing_sync_t pointing; 186 split_slave_pointing_sync_t pointing;
187#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) 187#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE)
188 188
189#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 189#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
190 rpc_sync_info_t rpc_info; 190 rpc_sync_info_t rpc_info;
191 uint8_t rpc_m2s_buffer[RPC_M2S_BUFFER_SIZE]; 191 uint8_t rpc_m2s_buffer[RPC_M2S_BUFFER_SIZE];
192 uint8_t rpc_s2m_buffer[RPC_S2M_BUFFER_SIZE]; 192 uint8_t rpc_s2m_buffer[RPC_S2M_BUFFER_SIZE];
193#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) 193#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
194} split_shared_memory_t; 194} split_shared_memory_t;
195 195
196extern split_shared_memory_t *const split_shmem; 196extern split_shared_memory_t *const split_shmem;