Struct stm32f4xx_hal::crc32::Crc32
source · pub struct Crc32 { /* private fields */ }
Expand description
A handle to a HAL CRC32 peripheral
Implementations§
source§impl Crc32
impl Crc32
sourcepub fn update(&mut self, data: &[u32]) -> u32
pub fn update(&mut self, data: &[u32]) -> u32
Feed words into the CRC engine.
The resulting calculated CRC (including this and prior data
since the last call to init()
is returned.
sourcepub fn update_bytes(&mut self, data: &[u8]) -> u32
pub fn update_bytes(&mut self, data: &[u8]) -> u32
Feed bytes into the CRC engine.
The resulting calculated CRC (including this and prior data
since the last call to init()
is returned.
NOTE: Each four-byte chunk will be copied into a scratch buffer. This is done to ensure alignment of the data (the CRC engine only processes full words at a time). If the number of bytes passed in are not a multiple of four, the MOST significant bytes of the remaining word will be zeroes.
This should be taken into consideration if attempting to feed bytes across multiple parts (that spurious zeroes will be inserted)! To avoid this, only feed multiples of 4 bytes in before the “final” part of the message.
Example: Given the following 7 bytes:
[0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77]
The following two words will be fed into the CRC engine:
0x4433_2211
0x0077_6655