From 04bc74d8f52370a01f1f67a5de8ae751e307e8c9 Mon Sep 17 00:00:00 2001
From: Stefan Kerkmann <karlk90@pm.me>
Date: Fri, 2 Jul 2021 23:28:32 +0200
Subject: [PATCH] Switch split_common to CRC subsystem (#13418)

---
 quantum/split_common/transactions.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/quantum/split_common/transactions.c b/quantum/split_common/transactions.c
index 99a8623b3cc..abad626e002 100644
--- a/quantum/split_common/transactions.c
+++ b/quantum/split_common/transactions.c
@@ -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);