Ring buffer
#include "buffer.tcc"
Class definition
-
template<uint8_t bits>
class Buffer Ring buffer.
Public Functions
-
Buffer(void)
Constructor.
-
uint8_t available(void)
Get the number of bytes available for reading.
- Returns
Number of bytes.
-
uint8_t read(uint8_t*, uint8_t)
Read
size
bytes of data.- Parameters
data – Buffer to receive
size
bytes of data.size – Number of bytes to read.
- Returns
Number of bytes read.
-
int16_t read(void)
Read one byte of data.
- Returns
The first byte of incoming data or
-1
if no data is available.
-
void write(uint8_t*, uint8_t)
Write
size
bytes of data.- Parameters
data – Buffer containing
size
bytes of data.size – Number of bytes to write.
- Returns
Number of bytes written.
-
void write(uint8_t)
Write one byte of data.
- Parameters
data – Data.
-
int16_t peek(void)
Return the next byte of incoming data without removing it from the buffer.
- Returns
The first byte of incoming data or
-1
if no data is available.
-
Buffer(void)