ATtiny85 Template Code
Code snippets for the ATtiny85
 All Files Functions Variables Typedefs Enumerations Enumerator Macros
utility.h File Reference
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void wait (uint16_t millis)
 
char hexChar (uint8_t value)
 
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.

char hexChar ( uint8_t  value)

Convert the low four bits of a byte value into an upper case hex digit.

Parameters
valuethe value to convert
Returns
the ASCII code for the appropriate hex digit.

Definition at line 37 of file utility.c.

Here is the caller graph for this function:

void wait ( uint16_t  millis)

An inaccurate delay function

This function will delay for the given number of milliseconds. This is not an accurate delay (interrupt activity will interfere with the timing and it uses instruction timing approximations to consume the time) but should be close enough for many purposes without having to revert to a timer interrupt.

Definition at line 21 of file utility.c.