peter-tanner.github.io/assets/lib/2024-10-20-SC03C2H5OH-Electroch/checksum.c
2024-11-15 05:23:42 +08:00

9 lines
250 B
C

unsigned char get_checksum(unsigned char array[], unsigned char array_size)
{
unsigned char checksum = 0;
for (unsigned char i = 1; i < array_size - 2; i++)
checksum += array[i];
checksum = (~checksum) + 1;
return checksum;
}