67 #define FIFO_DEF(name, ff_depth, type, is_overwritable) \
68 uint8_t name##_buffer[ff_depth*sizeof(type)];\
70 .buffer = name##_buffer,\
72 .item_size = sizeof(type),\
73 .overwritable = is_overwritable,\
82 static inline bool fifo_is_empty(
fifo_t* f)
84 return (f->
count == 0);
88 static inline bool fifo_is_full(
fifo_t* f)
94 static inline uint16_t fifo_get_length(
fifo_t* f)
volatile uint16_t rd_idx
read pointer
Definition: fifo.h:62
uint16_t const depth
max items
Definition: fifo.h:58
uint16_t const item_size
size of each item
Definition: fifo.h:59
void fifo_clear(fifo_t *f)
Clear the fifo read and write pointers and set length to zero.
Definition: fifo.c:138
#define ATTR_PURE
Many functions have no effects except the return value and their return value depends only on the par...
Definition: compiler_gcc.h:96
bool fifo_write(fifo_t *f, void const *p_data)
Write one byte into the RX buffer.
Definition: fifo.c:102
bool fifo_read(fifo_t *f, void *p_buffer)
Read one byte out of the RX buffer.
Definition: fifo.c:65
volatile uint16_t wr_idx
write pointer
Definition: fifo.h:61
uint8_t *const buffer
buffer pointer
Definition: fifo.h:57
Simple Circular FIFO.
Definition: fifo.h:55
#define ATTR_ALWAYS_INLINE
Generally, functions are not inlined unless optimization is specified. For functions declared inline...
Definition: compiler_gcc.h:89
volatile uint16_t count
number of items in queue
Definition: fifo.h:60