diff options
author | zvecr <git@zvecr.com> | 2022-02-25 23:45:40 +0000 |
---|---|---|
committer | zvecr <git@zvecr.com> | 2022-02-25 23:45:40 +0000 |
commit | e7931289918221081cbe2a7ea5df27a5d86324db (patch) | |
tree | 0b06145520f8aaf5ff5cb928aa5176fc2dd23619 /quantum/split_common/transport.c | |
parent | c0ee3d2c79388187883b1b1b1d1a0b6842acf741 (diff) | |
parent | cf31355f08dca311a013168eb3eb995e2fc6a3d1 (diff) |
Merge remote-tracking branch 'origin/develop'
Diffstat (limited to 'quantum/split_common/transport.c')
-rw-r--r-- | quantum/split_common/transport.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index bcc0261417..aade3c98d7 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -26,7 +26,7 @@ # ifndef SLAVE_I2C_TIMEOUT # define SLAVE_I2C_TIMEOUT 100 -# endif // SLAVE_I2C_TIMEOUT +# endif // SLAVE_I2C_TIMEOUT # ifndef SLAVE_I2C_ADDRESS # define SLAVE_I2C_ADDRESS 0x32 @@ -40,8 +40,12 @@ _Static_assert(sizeof(split_shared_memory_t) <= I2C_SLAVE_REG_COUNT, "split_shar split_shared_memory_t *const split_shmem = (split_shared_memory_t *)i2c_slave_reg; -void transport_master_init(void) { i2c_init(); } -void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); } +void transport_master_init(void) { + i2c_init(); +} +void transport_slave_init(void) { + i2c_slave_init(SLAVE_I2C_ADDRESS); +} i2c_status_t transport_trigger_callback(int8_t id) { // 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, return true; } -#else // USE_I2C +#else // USE_I2C # include "serial.h" static split_shared_memory_t shared_memory; split_shared_memory_t *const split_shmem = &shared_memory; -void transport_master_init(void) { soft_serial_initiator_init(); } -void transport_slave_init(void) { soft_serial_target_init(); } +void transport_master_init(void) { + soft_serial_initiator_init(); +} +void transport_slave_init(void) { + soft_serial_target_init(); +} bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, uint16_t initiator2target_length, void *target2initiator_buf, uint16_t target2initiator_length) { split_transaction_desc_t *trans = &split_transaction_table[id]; @@ -99,7 +107,7 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, memcpy(split_trans_initiator2target_buffer(trans), initiator2target_buf, len); } - if (soft_serial_transaction(id) != TRANSACTION_END) { + if (!soft_serial_transaction(id)) { return false; } @@ -111,8 +119,12 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, return true; } -#endif // USE_I2C +#endif // USE_I2C -bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { return transactions_master(master_matrix, slave_matrix); } +bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + return transactions_master(master_matrix, slave_matrix); +} -void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { transactions_slave(master_matrix, slave_matrix); } +void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + transactions_slave(master_matrix, slave_matrix); +} |