embeddedlibrary
reusable software modules for embedded systems
|
#include <itemBuffer.h>
Data Fields | |
uint16_t | size |
uint8_t | item_size |
uint16_t * | front |
uint16_t * | rear |
uint16_t * | buffer_start |
uint16_t * | buffer_end |
void(* | Callback )(void *buf) |
The FIFO buffer can buffer any data type, from a char to a complex structure. Define item_t to be the type of data to buffer. Default is char, it is suggested to override this in system.h if desired.
Note: only one data type can be defined per build. If two different data type buffers are required in a single project you can make copies of buffer.h and buffer.c or update the module to track the item size per buffer.data structure to hold the required information for each buffer
uint16_t* buffer_end |
buffer end location in memory >
uint16_t* buffer_start |
buffer start location in memory >
void(* Callback) (void *buf) |
Push callback, useful if buffer is used for communications, does not need to be used/set, initializes to 0>
uint16_t* front |
pointer to first item in buffer >
uint8_t item_size |
item size is the number of words in the item type>
uint16_t* rear |
pointer to next open position in the buffer >
uint16_t size |
size is the number of items in the buffer >