2 <util/crc16.h>: CRC Computations
This header file provides a optimized inline functions for calculating cyclic redundancy checks (CRC) using common polynomials.
- References:
A typical application would look like:
// Dallas iButton test vector. uint8_t serno[] = { 0x02, 0x1c, 0xb8, 0x01, 0, 0, 0, 0xa2 }; int checkcrc(void) { uint8_t crc = 0, i; for (i = 0; i < sizeof serno / sizeof serno[0]; i++) crc = _crc_ibutton_update(crc, serno[i]); return crc; // must be 0 }