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
newByteByte to append to CRC16 calculation
prevResultPrevious 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
bufferBuffer containing bytes to append to CRC16 calculation
lengthSize of the buffer in bytes
prevResultPrevious output from CRC algorithm. BTL_CRC16_START when starting a new calculation.
Returns
Result of the CRC16 operation