Data Structures | |
struct | fifo_t |
Simple Circular FIFO. More... | |
Macros | |
#define | FIFO_DEF(name, ff_depth, type, is_overwritable) |
Functions | |
bool | fifo_write (fifo_t *f, void const *p_data) |
Write one byte into the RX buffer. More... | |
bool | fifo_read (fifo_t *f, void *p_buffer) |
Read one byte out of the RX buffer. More... | |
void | fifo_clear (fifo_t *f) |
Clear the fifo read and write pointers and set length to zero. More... | |
static bool | fifo_is_empty (fifo_t *f) ATTR_PURE ATTR_ALWAYS_INLINE |
static bool | fifo_is_full (fifo_t *f) ATTR_PURE ATTR_ALWAYS_INLINE |
static uint16_t | fifo_get_length (fifo_t *f) ATTR_PURE ATTR_ALWAYS_INLINE |
Variables | |
uint8_t *const | buffer |
buffer pointer | |
uint16_t const | depth |
max items | |
uint16_t const | item_size |
size of each item | |
volatile uint16_t | count |
number of items in queue | |
volatile uint16_t | wr_idx |
write pointer | |
volatile uint16_t | rd_idx |
read pointer | |
bool | overwritable |
#define FIFO_DEF | ( | name, | |
ff_depth, | |||
type, | |||
is_overwritable | |||
) |
void fifo_clear | ( | fifo_t * | f | ) |
bool fifo_read | ( | fifo_t * | f, |
void * | p_buffer | ||
) |
Read one byte out of the RX buffer.
This function will return the byte located at the array index of the read pointer, and then increment the read pointer index. If the read pointer exceeds the maximum buffer size, it will roll over to zero.
[in] | f | Pointer to the FIFO buffer to manipulate |
[in] | data | Pointer to the place holder for data read from the buffer |
bool fifo_write | ( | fifo_t * | f, |
void const * | p_data | ||
) |
Write one byte into the RX buffer.
This function will write one byte into the array index specified by the write pointer and increment the write index. If the write index exceeds the max buffer size, then it will roll over to zero.
[in] | f | Pointer to the FIFO buffer to manipulate |
[in] | data | The byte to add to the FIFO |