mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
60 lines
958 B
C++
60 lines
958 B
C++
//
|
|
// FILE: CRC64_test.ino
|
|
// AUTHOR: Rob Tillaart
|
|
// PURPOSE: demo
|
|
// DATE: 2021-01-20
|
|
// (c) : MIT
|
|
|
|
|
|
#include "CRC64.h"
|
|
#include "printHelpers.h" // https://github.com/RobTillaart/printHelpers
|
|
|
|
char str[24] = "123456789";
|
|
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
Serial.println(__FILE__);
|
|
|
|
// Serial.println("Verified with - http://zorc.breitbandkatze.de/crc.html \n");
|
|
|
|
test();
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
}
|
|
|
|
|
|
void test()
|
|
{
|
|
CRC64 crc;
|
|
crc.add((uint8_t*)str, 9);
|
|
Serial.println(print64(crc.calc(), HEX));
|
|
|
|
crc.restart();
|
|
for (int i = 0; i < 9; i++)
|
|
{
|
|
crc.add(str[i]);
|
|
}
|
|
Serial.println(print64(crc.calc(), HEX));
|
|
|
|
CRC64 customCrc(0x07);
|
|
customCrc.add((uint8_t*)str, 9);
|
|
Serial.println(print64(customCrc.calc(), HEX));
|
|
|
|
customCrc.restart();
|
|
for (int i = 0; i < 9; i++)
|
|
{
|
|
customCrc.add(str[i]);
|
|
}
|
|
Serial.println(print64(customCrc.calc(), HEX));
|
|
Serial.println(customCrc.count());
|
|
}
|
|
|
|
|
|
// -- END OF FILE --
|
|
|