avr-fw-modules/core/src/chksum.c

26 lines
312 B
C
Executable File

#include <hwo/chksum.h>
#include <stdlib.h>
#include <string.h>
void chksum(avrChksum* chksum,void* block,uint8_t len)
{
uint8_t p;
uint8_t *b = (uint8_t*)block;
if (chksum == NULL)
return;
chksum->combined = 0x00;
for (p=0;p<len;p++)
{
chksum->sum8 += b[p];
chksum->xor8 ^= b[p];
};
};