Switch split_common to CRC subsystem (#13418)

This commit is contained in:
Stefan Kerkmann 2021-07-02 23:28:32 +02:00 committed by GitHub
parent 638373a16c
commit 04bc74d8f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@
#include <string.h>
#include <stddef.h>
#include "crc.h"
#include "debug.h"
#include "matrix.h"
#include "quantum.h"
@ -43,22 +44,6 @@
#define transport_write(id, data, length) transport_execute_transaction(id, data, length, NULL, 0)
#define transport_read(id, data, length) transport_execute_transaction(id, NULL, 0, data, length)
static uint8_t crc8(const void *data, size_t len) {
const uint8_t *p = (const uint8_t *)data;
uint8_t crc = 0xff;
size_t i, j;
for (i = 0; i < len; i++) {
crc ^= p[i];
for (j = 0; j < 8; j++) {
if ((crc & 0x80) != 0)
crc = (uint8_t)((crc << 1) ^ 0x31);
else
crc <<= 1;
}
}
return crc;
}
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
// Forward-declare the RPC callback handlers
void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer);