Class ByteFifo
template <int Size>
#include <ByteFifo.hpp>
Public Functions
Type | Name |
---|---|
ByteFifo () |
|
size_t | available () const Readable bytes. |
void | clear () Clears the buffer by setting m_tail = m_head;. |
uint8_t * | data () const Pointer to the beginning. |
bool | hasData () const True if some data is ready for reading. |
void | notifyRead (size_t len) Move the read index (tail), indicating len bytes have been read out. |
void | notifyWritten (size_t len) Move the write index (head), indicating len bytes have been written. |
void | peekSpan (uint8_t * data, size_t len) Read len bytes into buffer starting at data. |
uint8_t | pop () Reads one byte, must be available. |
void | push (uint8_t b) Writes one byte. |
std::pair< uint8_t *, size_t > | readableSpan () const |
void | setHead (int newHead) Override the write index aka. head. |
constexpr size_t | size () const Total capacity. |
void | writeSpan (uint8_t * data, size_t len) Write len bytes into buffer starting at data. |
std::pair< uint8_t *, size_t > | writeableSpan () const |
Detailed Description
A DMA-ready byte ring buffer with contiguous I/O API Allows direct read/write access using: readableSpan() -> read-out -> notifyRead() writeableSpan() -> write-in -> notifyWritten()
Public Functions Documentation
function ByteFifo
inline ByteFifo::ByteFifo ()
function available
inline size_t ByteFifo::available () const
function clear
inline void ByteFifo::clear ()
function data
inline uint8_t * ByteFifo::data () const
function hasData
inline bool ByteFifo::hasData () const
function notifyRead
inline void ByteFifo::notifyRead (
size_t len
)
function notifyWritten
inline void ByteFifo::notifyWritten (
size_t len
)
function peekSpan
inline void ByteFifo::peekSpan (
uint8_t * data,
size_t len
)
function pop
inline uint8_t ByteFifo::pop ()
function push
inline void ByteFifo::push (
uint8_t b
)
function readableSpan
inline std::pair< uint8_t *, size_t > ByteFifo::readableSpan () const
Gets a contiguous range of bytes ready for reading. Doesn't represent all readable bytes if wrapped over the end. Zero size_t means FIFO is empty.
function setHead
inline void ByteFifo::setHead (
int newHead
)
function size
inline constexpr size_t ByteFifo::size () const
function writeSpan
inline void ByteFifo::writeSpan (
uint8_t * data,
size_t len
)
function writeableSpan
inline std::pair< uint8_t *, size_t > ByteFifo::writeableSpan () const
Gets a contiguous range of bytes ready for writing. Doesn't represent all writeable bytes if wrapped over the end. Zero size_t means FIFO is full.
The documentation for this class was generated from the following file demo-projets/stm32/include/utils/ByteFifo.hpp