Serial Port
|
Ring buffer for RX and TX data. More...
#include <SerialPort.h>
Public Types | |
typedef uint16_t | buf_size_t |
Public Member Functions | |
int | available () |
bool | empty () |
void | flush () |
bool | get (uint8_t *b) |
buf_size_t | get (uint8_t *b, buf_size_t n) |
void | init (uint8_t *b, buf_size_t s) |
int | peek () |
bool | put (uint8_t b) |
buf_size_t | put (const uint8_t *b, buf_size_t n) |
buf_size_t | put_P (PGM_P b, buf_size_t n) |
Ring buffer for RX and TX data.
Definition at line 246 of file SerialPort.h.
typedef uint16_t SerialRingBuffer::buf_size_t |
Define type for buffer indices
Definition at line 250 of file SerialPort.h.
int SerialRingBuffer::available | ( | ) |
Definition at line 30 of file SerialPort.cpp.
bool SerialRingBuffer::empty | ( | ) | [inline] |
true
if the ring buffer is empty else false
. Definition at line 256 of file SerialPort.h.
void SerialRingBuffer::flush | ( | ) |
Discard all data in the ring buffer.
Definition at line 42 of file SerialPort.cpp.
bool SerialRingBuffer::get | ( | uint8_t * | b | ) |
Get the next byte from the ring buffer.
[in] | b | location for the returned byte |
true
if a byte was returned or false
if the ring buffer is empty Definition at line 54 of file SerialPort.cpp.
SerialRingBuffer::buf_size_t SerialRingBuffer::get | ( | uint8_t * | b, |
buf_size_t | n | ||
) |
Get the maximum number of contiguous bytes from the ring buffer with one call to memcpy.
[in] | b | Pointer to the data. |
[in] | n | Number of bytes to transfer from the ring buffer. |
Definition at line 72 of file SerialPort.cpp.
void SerialRingBuffer::init | ( | uint8_t * | b, |
buf_size_t | s | ||
) |
Initialize the ring buffer.
[in] | b | Buffer for the data. |
[in] | s | Size of the buffer. |
Definition at line 96 of file SerialPort.cpp.
int SerialRingBuffer::peek | ( | ) |
Peek at the next byte in the ring buffer.
Definition at line 105 of file SerialPort.cpp.
bool SerialRingBuffer::put | ( | uint8_t | b | ) |
Put a byte into the ring buffer.
[in] | b | the byte |
true
if byte was transferred or false
if the ring buffer is full. Definition at line 115 of file SerialPort.cpp.
SerialRingBuffer::buf_size_t SerialRingBuffer::put | ( | const uint8_t * | b, |
buf_size_t | n | ||
) |
Put the maximum number of contiguous bytes into the ring buffer. with one call to memcpy.
[in] | b | pointer to data. |
[in] | n | number of bytes to transfer to the ring buffer. |
Definition at line 136 of file SerialPort.cpp.
SerialRingBuffer::buf_size_t SerialRingBuffer::put_P | ( | PGM_P | b, |
buf_size_t | n | ||
) |
Put the maximum number of contiguous bytes into the ring buffer. with one call to memcpy.
[in] | b | pointer to data. |
[in] | n | number of bytes to transfer to the ring buffer. |
Definition at line 165 of file SerialPort.cpp.