2021-01-29 06:31:58 -05:00
|
|
|
//
|
|
|
|
// FILE: CRC_test.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo
|
|
|
|
// DATE: 2020
|
|
|
|
// (c) : MIT
|
|
|
|
//
|
|
|
|
|
2021-12-14 14:22:40 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#include "CRC.h"
|
|
|
|
#include "printHelpers.h" // for the 64 bit...
|
|
|
|
|
|
|
|
char str[24] = "123456789";
|
|
|
|
|
2021-12-14 14:22:40 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
|
|
|
|
uint8_t * data = (uint8_t *) &str[0];
|
|
|
|
|
|
|
|
Serial.println("Verified with - https://crccalc.com/\n");
|
|
|
|
|
|
|
|
Serial.print("TEST:\t");
|
|
|
|
Serial.println(str);
|
|
|
|
Serial.print("CRC8:\t");
|
|
|
|
Serial.println(crc8(data, 9, 0x07, 0x00, 0x00, false, false), HEX);
|
|
|
|
Serial.print("CRC16:\t");
|
|
|
|
Serial.println(crc16(data, 9, 0x1021, 0x0000, 0x0000, false, false ), HEX);
|
|
|
|
Serial.print("CRC32:\t");
|
|
|
|
Serial.println(crc32(data, 9, 0x04C11DB7, 0x00000000, 0x00000000, false, false), HEX);
|
|
|
|
// Serial.print("*CRC64:\t");
|
|
|
|
// uint64_t t = crc64(data, 9, 0x814141AB, 0x00000000, 0x00000000, false, false);
|
|
|
|
// Serial.println(print64(t, HEX));
|
|
|
|
|
|
|
|
Serial.println("\n\nDone...");
|
|
|
|
}
|
|
|
|
|
2021-12-14 14:22:40 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-12-14 14:22:40 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
// -- END OF FILE --
|
2021-12-14 14:22:40 -05:00
|
|
|
|