/*
FastCRC-Example
(c) Frank Boesing 2014
*/
#include <FastCRC.h>
FastCRC8 CRC8;
uint8_t buf[24] = {'1', '0', '0', '0', '0', '0', '0', '0' , '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'};
void setup() {
delay(1500);
Serial.begin(115200);
Serial.println("CRC Example");
Serial.println();
Serial.print("SMBUS-CRC of \"");
for (unsigned int i = 0; i < sizeof(buf); i++) {
Serial.print((char) buf[i]);
}
Serial.print("\" is: 0x");
Serial.println( CRC8.smbus(buf, sizeof(buf)), HEX );
}
void loop() {
}
/*
FastCRC-Example
(c) Frank Boesing 2014
*/
#include <FastCRC.h>
FastCRC8 CRC8;
//uint8_t buf[24] = {'1', '0', '0', '0', '0', '0', '0', '0' , '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'};
uint8_t buf[3] = {0x64,0x29,0x22};
void setup()
{
Serial.begin(115200);
while(!Serial);
Serial.println("CRC Example");
Serial.println();
Serial.print("SMBUS-CRC of \"");
for (unsigned int i = 0; i < sizeof(buf); i++) {
Serial.printf("0x%02x,",buf[i]);
}
Serial.print("\" is: 0x");
Serial.println( CRC8.smbus(buf, sizeof(buf)), HEX );
}
void loop()
{
}
CRC Example
SMBUS-CRC of "0x64,0x29,0x22," is: 0x93
/*
FastCRC-Example
(c) Frank Boesing 2014
*/
#include <FastCRC.h>
FastCRC8 CRC8;
const char *buf = "011001000010100100100010";
void setup()
{
Serial.begin(115200);
while(!Serial);
Serial.println("CRC Example");
Serial.println();
Serial.print("SMBUS-CRC of \"");
Serial.print(buf);
Serial.print("\" is: 0x");
Serial.println( CRC8.smbus(buf, strlen(buf)), HEX );
}
void loop()
{
}
CRC Example
SMBUS-CRC of "011001000010100100100010" is: 0x7D