From ef92c9ee2cf4745637635ec1895399e4f013914c Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Fri, 18 Jun 2021 01:09:43 +0200 Subject: Add CRC8 calculation subsystem to quantum (#12641) * Intended usage is data validation in split transport code. * Default space efficient algorithm. * Opt-in fast table based algorithmn with #define CRC8_USE_TABLE switch. * Define switches for size and speed optimized versions, the default is size optimized by using uint_least8_t as datatype for calculations. * #define CRC8_OPTIMIZE_SPEED uses uint_fast8_t as datatype for calculations, this only affects 32-bit Archs like ARM and RISC-V. * Placeholder crc_init() function for hardware backed crc calculation, not implemented yet. --- tmk_core/common/keyboard.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tmk_core') diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 249da85bd2..28fa97bc8f 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -103,6 +103,9 @@ along with this program. If not, see . #ifdef EEPROM_DRIVER # include "eeprom_driver.h" #endif +#if defined(CRC_ENABLE) +# include "crc.h" +#endif static uint32_t last_input_modification_time = 0; uint32_t last_input_activity_time(void) { return last_input_modification_time; } @@ -300,6 +303,9 @@ void keyboard_init(void) { timer_init(); sync_timer_init(); matrix_init(); +#if defined(CRC_ENABLE) + crc_init(); +#endif #ifdef VIA_ENABLE via_init(); #endif -- cgit v1.2.3