Safe Sprinkler
Master/slave irrigation system (ESP-NOW + LoRaWAN)
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
fifo.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <string.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_t
 

Macros

#define FIFO_SIZE   128
 

Functions

void fifo_init (fifo_t *f)
 Initialize a FIFO to empty state.
 
bool fifo_write (fifo_t *f, const void *data, uint16_t len)
 Write bytes into the FIFO.
 
bool fifo_read (fifo_t *f, void *data, uint16_t len)
 Read bytes from the FIFO.
 

Macro Definition Documentation

◆ FIFO_SIZE

#define FIFO_SIZE   128

Function Documentation

◆ fifo_init()

void fifo_init ( fifo_t f)

Initialize a FIFO to empty state.

Parameters
fPointer to fifo_t to initialize

◆ fifo_read()

bool fifo_read ( fifo_t f,
void *  data,
uint16_t  len 
)

Read bytes from the FIFO.

Parameters
fPointer to initialized fifo_t
dataDestination buffer
lenNumber of bytes to read
Returns
true if len bytes were read, false if not enough data (FIFO unchanged)

◆ fifo_write()

bool fifo_write ( fifo_t f,
const void *  data,
uint16_t  len 
)

Write bytes into the FIFO.

Parameters
fPointer to initialized fifo_t
dataSource buffer (must not overlap with fifo buffer)
lenNumber of bytes to write
Returns
true if all bytes were written, false if not enough space (FIFO unchanged)