ATtiny85 Template Code
Code snippets for the ATtiny85
 All Files Functions Variables Typedefs Enumerations Enumerator Macros
crc16.c File Reference
#include <avr/pgmspace.h>
#include "utility.h"
Include dependency graph for crc16.c:

Go to the source code of this file.

Functions

uint16_t crcInit ()
 
uint16_t crcByte (uint16_t crc, uint8_t data)
 
uint16_t crcData (uint16_t crc, const uint8_t *pData, uint8_t length)
 
uint16_t crcDataP (uint16_t crc, const uint8_t *pData, uint8_t length)
 

Function Documentation

uint16_t crcByte ( uint16_t  crc,
uint8_t  data 
)

Add a byte to an ongoing CRC calculation

Update the CRC value with an additional data byte.

Parameters
crcthe current CRC value
datathe data byte to add to the calculation
Returns
the updated CRC value.

Definition at line 44 of file crc16.c.

Here is the caller graph for this function:

uint16_t crcData ( uint16_t  crc,
const uint8_t *  pData,
uint8_t  length 
)

Add a block of data to an ongoing CRC calculation

Add a sequence of bytes from a buffer in RAM. Note that this function can process up to 255 bytes in a single call (which is usually enough for a microcontroller application).

Parameters
crcthe current CRC value
pDatapointer to the memory buffer
lengththe number of bytes to process.
Returns
the updated CRC value.

Definition at line 74 of file crc16.c.

Here is the call graph for this function:

uint16_t crcDataP ( uint16_t  crc,
const uint8_t *  pData,
uint8_t  length 
)

Add a block of data to an ongoing CRC calculation

Add a sequence of bytes from a buffer in PROGMEM. Note that this function can process up to 255 bytes in a single call (which is usually enough for a microcontroller application).

Parameters
crcthe current CRC value
pDatapointer to the memory location.
lengththe number of bytes to process.
Returns
the updated CRC value.

Definition at line 92 of file crc16.c.

Here is the call graph for this function:

uint16_t crcInit ( )

Initialise the CRC calculation

Initialises the CRC value prior to processing data.

Returns
the initial CRC value.

Definition at line 31 of file crc16.c.