Function sensirion_i2c::crc8::validate
source · pub fn validate(buf: &[u8]) -> Result<(), Error>
Expand description
Iterate over the provided buffer and validate the CRC8 checksums.
The buffer must be in the form of [d0, d1, crc01, d2, d3, crc23, ...]
where every third byte
is the checksum byte of the previous two bytes
If the checksum is wrong, return Err
.
§Panics
This method will consider every third byte a checksum byte. If the buffer size is not a multiple of 3, then it will panic.