MCU-Common
Modules useful for embedded (MCU) programming
fifo.h File Reference
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for fifo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fifo
 FIFO instance. More...
 

Macros

#define FIFO_INIT(fifo, elem_size, fifo_capacity)
 Allocates buffer and initializes fifo instance. More...
 

Functions

bool fifo_init (struct fifo *fifo)
 Initializes FIFO. More...
 
size_t fifo_capacity (const struct fifo *fifo)
 Returns number of elements the FIFO can hold. More...
 
size_t fifo_readable (const struct fifo *fifo)
 Returns number of elements which can be read from the FIFO. More...
 
size_t fifo_writable (const struct fifo *fifo)
 Returns number of elements which can be written to the FIFO. More...
 
size_t fifo_read (struct fifo *fifo, void *dst, size_t count)
 Reads data from FIFO. More...
 
size_t fifo_write (struct fifo *fifo, const void *src, size_t count)
 Writes data to FIFO. More...
 
size_t fifo_gets (struct fifo *fifo, char *str)
 Reads null-terminated string from FIFO. More...
 
size_t fifo_puts (struct fifo *fifo, const char *str)
 Writes null-terminated string to FIFO. More...