#ifndef LRC_H
#define LRC_H
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
unsigned char LRC(unsigned char *bytes, size_t bytesLength);
#ifdef __cplusplus
}
#endif
#endif
#include "LRC.h"
unsigned char LRC(unsigned char* bytes, size_t bytesLength) {
unsigned char byte = 0;
for (size_t i = 0; i < bytesLength; i++) {
byte += bytes[i];
byte &= 0xFF;
}
return 256 - byte;
}