Description

CRC16 functionality for the bootloader.

Macros

#define BTL_CRC16_START 0xFFFFU
CRC16 start value.

Functions

uint16_t btl_crc16 (const uint8_t newByte, uint16_t prevResult)
uint16_t btl_crc16Stream (const uint8_t *buffer, size_t length, uint16_t prevResult)

Function Documentation

uint16_t btl_crc16 ( const uint8_t newByte,
uint16_t prevResult
)

Calculate CRC16 on input.

Parameters
newByte Byte to append to CRC16 calculation
prevResult Previous output from CRC algorithm. BTL_CRC16_START when starting a new calculation.
Returns
Result of the CRC16 operation
uint16_t btl_crc16Stream ( const uint8_t * buffer,
size_t length,
uint16_t prevResult
)

Calculate CRC16 on input stream.

Parameters
buffer Buffer containing bytes to append to CRC16 calculation
length Size of the buffer in bytes
prevResult Previous output from CRC algorithm. BTL_CRC16_START when starting a new calculation.
Returns
Result of the CRC16 operation