peter-tanner.github.io/assets/lib/2024-10-20-SC03C2H5OH-Electroch/checksum.c

9 lines
250 B
C
Raw Permalink Normal View History

2024-11-15 05:23:42 +08:00
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;
}