GY-63_MS5611/libraries/CRC/examples/CRC8_test/CRC8_test.ino
rob tillaart 87ad71de4d 0.1.4 CRC
2021-12-14 20:22:40 +01:00

67 lines
919 B
C++

//
// FILE: CRC8_test.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// DATE: 2021-01-20
// (c) : MIT
#include "CRC8.h"
#include "CRC.h"
char str[24] = "123456789";
CRC8 crc;
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
// Serial.println("Verified with - https://crccalc.com/\n");
test();
}
void loop()
{
}
void test()
{
Serial.println(crc8((uint8_t *)str, 9, 0x07), HEX);
crc.setPolynome(0x07);
crc.add((uint8_t*)str, 9);
Serial.println(crc.getCRC(), HEX);
crc.reset();
crc.setPolynome(0x07);
for (int i = 0; i < 9; i++)
{
crc.add(str[i]);
}
Serial.println(crc.getCRC(), HEX);
crc.restart();
for (int i = 0; i < 9; i++)
{
crc.add(str[i]);
}
Serial.println(crc.getCRC(), HEX);
for (int i = 0; i < 9; i++)
{
crc.add(str[i]);
}
Serial.println(crc.getCRC(), HEX);
Serial.println(crc.count());
}
// -- END OF FILE --