diff options
author | Stefan Kerkmann <karlk90@pm.me> | 2021-07-02 23:28:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-02 22:28:32 +0100 |
commit | 04bc74d8f52370a01f1f67a5de8ae751e307e8c9 (patch) | |
tree | da28538e8703c78c1a947f5d5c5ec25b95dc8f5f /quantum/split_common/transactions.c | |
parent | 638373a16c7111e21ccf41883850db6ba97c4475 (diff) | |
download | qmk_firmware-04bc74d8f52370a01f1f67a5de8ae751e307e8c9.tar.gz qmk_firmware-04bc74d8f52370a01f1f67a5de8ae751e307e8c9.zip |
Switch split_common to CRC subsystem (#13418)
Diffstat (limited to 'quantum/split_common/transactions.c')
-rw-r--r-- | quantum/split_common/transactions.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/quantum/split_common/transactions.c b/quantum/split_common/transactions.c index 99a8623b3..abad626e0 100644 --- a/quantum/split_common/transactions.c +++ b/quantum/split_common/transactions.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <string.h> | 17 | #include <string.h> |
18 | #include <stddef.h> | 18 | #include <stddef.h> |
19 | 19 | ||
20 | #include "crc.h" | ||
20 | #include "debug.h" | 21 | #include "debug.h" |
21 | #include "matrix.h" | 22 | #include "matrix.h" |
22 | #include "quantum.h" | 23 | #include "quantum.h" |
@@ -43,22 +44,6 @@ | |||
43 | #define transport_write(id, data, length) transport_execute_transaction(id, data, length, NULL, 0) | 44 | #define transport_write(id, data, length) transport_execute_transaction(id, data, length, NULL, 0) |
44 | #define transport_read(id, data, length) transport_execute_transaction(id, NULL, 0, data, length) | 45 | #define transport_read(id, data, length) transport_execute_transaction(id, NULL, 0, data, length) |
45 | 46 | ||
46 | static uint8_t crc8(const void *data, size_t len) { | ||
47 | const uint8_t *p = (const uint8_t *)data; | ||
48 | uint8_t crc = 0xff; | ||
49 | size_t i, j; | ||
50 | for (i = 0; i < len; i++) { | ||
51 | crc ^= p[i]; | ||
52 | for (j = 0; j < 8; j++) { | ||
53 | if ((crc & 0x80) != 0) | ||
54 | crc = (uint8_t)((crc << 1) ^ 0x31); | ||
55 | else | ||
56 | crc <<= 1; | ||
57 | } | ||
58 | } | ||
59 | return crc; | ||
60 | } | ||
61 | |||
62 | #if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) | 47 | #if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) |
63 | // Forward-declare the RPC callback handlers | 48 | // Forward-declare the RPC callback handlers |
64 | void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); | 49 | void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); |