SerialBuffer Struct Reference

FIFO buffer used for both receive and transmit data. More...

#include <SerialBuffer.h>

Public Member Functions

 ~SerialBuffer ()
 
size_t getSize ()
 
size_t available ()
 get number of bytes stored in the buffer More...
 
size_t getFreeSpace ()
 get number of bytes of space available in this buffer More...
 
bool isEmpty ()
 
bool isFull ()
 
int peekChar ()
 see if there's anything in the buffer More...
 
int peekLastChar ()
 
int readChar ()
 
size_t writeChar (uint8_t c)
 
int find (uint8_t c)
 find a character in the buffer More...
 
size_t resize (size_t newSize)
 
void clear ()
 
size_t getReadData (void *&data)
 Access data directly within buffer. More...
 
void skipRead (size_t length)
 Skip a number of chars starting at the given read position. More...
 

Detailed Description

FIFO buffer used for both receive and transmit data.

Note
For receive operations, data is written via ISR and read via task For transmit operations, data is written via task and read via ISR Only routines marked with __forceinline or IRAM_ATTR may be called from interrupt context.

Constructor & Destructor Documentation

◆ ~SerialBuffer()

SerialBuffer::~SerialBuffer ( )
inline

Member Function Documentation

◆ available()

size_t SerialBuffer::available ( )
inline

get number of bytes stored in the buffer

Return values
size_t

◆ clear()

void SerialBuffer::clear ( void  )
inline

◆ find()

int SerialBuffer::find ( uint8_t  c)

find a character in the buffer

Parameters
c
Return values
intposition relative to current read pointer, -1 if character not found

◆ getFreeSpace()

size_t SerialBuffer::getFreeSpace ( )
inline

get number of bytes of space available in this buffer

Return values
size_t

◆ getReadData()

size_t SerialBuffer::getReadData ( void *&  data)
inline

Access data directly within buffer.

Parameters
void*&OUT: the data
Return values
size_tnumber of chars available

◆ getSize()

size_t SerialBuffer::getSize ( )
inline

◆ isEmpty()

bool SerialBuffer::isEmpty ( )
inline

◆ isFull()

bool SerialBuffer::isFull ( )
inline

◆ peekChar()

int SerialBuffer::peekChar ( )
inline

see if there's anything in the buffer

Return values
intfirst available character, or -1 if buffer's empty

◆ peekLastChar()

int SerialBuffer::peekLastChar ( )
inline

◆ readChar()

int SerialBuffer::readChar ( )
inline

◆ resize()

size_t SerialBuffer::resize ( size_t  newSize)

◆ skipRead()

void SerialBuffer::skipRead ( size_t  length)
inline

Skip a number of chars starting at the given read position.

Parameters
lengthMUST be <= value returned from peek()
Note
Provided for efficient buffer access

◆ writeChar()

size_t SerialBuffer::writeChar ( uint8_t  c)
inline

The documentation for this struct was generated from the following file: