AWS IoT for ESP32 v1.0.0
An ESP-IDF based solution
lib_ringBuffer.h File Reference

Rig buffer library header file. More...

Go to the source code of this file.

Data Structures

struct  rb_st
 Ring buffer structure. More...
 

Functions

bool RB_init (rb_st *ps_rb, uint16_t sizeOfElement_u16, uint16_t noOfElements_u16)
 Intialize the ring buffer. More...
 
void RB_free (rb_st *ps_rb)
 Free the memory associated with ring buffer. More...
 
void RB_clear (rb_st *ps_rb)
 Clear the ring buffer. More...
 
uint16_t RB_available (rb_st *ps_rb)
 Number of bytes available in a ring buffer. More...
 
uint16_t RB_hasSpace (rb_st *ps_rb)
 Check if ring buffer is not full. More...
 
bool RB_write (rb_st *ps_rb, void *pBuffer)
 Write data to ring buffer. More...
 
bool RB_read (rb_st *ps_rb, void *pBuffer)
 Read data from ring buffer. More...
 

Detailed Description

Rig buffer library header file.

Function Documentation

◆ RB_available()

uint16_t RB_available ( rb_st ps_rb)

Number of bytes available in a ring buffer.

Parameters
[in]ps_rbInstance of ring buffer
Returns
Number of bytes written in a ring buffer

◆ RB_clear()

void RB_clear ( rb_st ps_rb)

Clear the ring buffer.

Parameters
[in]ps_rbInstance of ring buffer
Returns
none

◆ RB_free()

void RB_free ( rb_st ps_rb)

Free the memory associated with ring buffer.

Parameters
[in]ps_rbInstance of ring buffer
Returns
none

◆ RB_hasSpace()

uint16_t RB_hasSpace ( rb_st ps_rb)

Check if ring buffer is not full.

Parameters
[in]ps_rbInstance of ring buffer
Returns
Number of bytes that are remaining in ring buffer

◆ RB_init()

bool RB_init ( rb_st ps_rb,
uint16_t  sizeOfElement_u16,
uint16_t  noOfElements_u16 
)

Intialize the ring buffer.

Parameters
[in]ps_rbInstance of ring buffer
[in]sizeOfElement_u16size of each element in ring buffer
[in]noOfElements_u16Total number of elements in a ring buffer
Returns
status of initialization
Return values
trueon success
falseon errors

◆ RB_read()

bool RB_read ( rb_st ps_rb,
void *  pBuffer 
)

Read data from ring buffer.

Parameters
[in]ps_rbInstance of ring buffer
[out]pBufferdata read from ring buffer
Returns
status of read operation
Return values
trueon successful read
falseon errors

◆ RB_write()

bool RB_write ( rb_st ps_rb,
void *  pBuffer 
)

Write data to ring buffer.

Parameters
[in]ps_rbInstance of ring buffer
[in]pBufferdata to be written
Returns
Status of write operation
Return values
trueon successful write
falseon errors