Refactor for public API

This commit is contained in:
2023-02-02 01:14:29 -06:00
parent dab8e0029e
commit e60aa4c2e3
25 changed files with 607 additions and 535 deletions
+16
View File
@@ -0,0 +1,16 @@
#include "message.h"
#include "crc.h"
enum MESSAGEERR
message_validate(const union Message* message) {
uint16_t length = (message->header.length_h & 0x3) * 0xFF + message->header.length_l;
if(message->header.crc != crc8(message, 3))
return MESSAGEERR_HEADERCRC;
if(message->header.crc != crc16(message, length - sizeof(struct Footer)))
return MESSAGEERR_FOOTERCRC;
}