Skip to main content

crc

Function crc 

Source
pub fn crc(bytes: &[u8]) -> u8
Expand description

Computes the CRC-8 that follows every data word.

The parameters are those of Table 32: polynomial 0x31, initial value 0xFF, no input or output reflection, no final XOR. The datasheet’s own check value is crc(&[0xBE, 0xEF]) == 0x92.

§Arguments

  • bytes - the bytes the checksum covers, normally one 16-bit word.

§Returns

The 8-bit checksum.