Class hal::read_into
Non-blocking callable for reading serial data into a buffer.
#include <serial_coroutines.hpp>
Public Functions
Type | Name |
---|---|
result< work_state > | operator() () read data into the buffer. |
read_into (serial & p_serial, std::span< hal::byte > p_buffer, size_t p_read_limit=32) Construct a new read_into object. |
Public Functions Documentation
function operator()
read data into the buffer.
inline result< work_state > hal::read_into::operator() ()
This function will return if the read limit is reached or if there are no more bytes in the serial port.
Call this function again to resume reading from the port.
Returns:
result<work_state> - work_state::in_progress if the sequence hasn't been met and the buffer still has space.
Returns:
result<work_state> - work_state::finished if the sequence was found before the buffer was filled completely.
function read_into
Construct a new read_into object.
inline hal::read_into::read_into (
serial & p_serial,
std::span< hal::byte > p_buffer,
size_t p_read_limit=32
)
Parameters:
p_serial
- serial port to skip throughp_buffer
- buffer to read data intop_read_limit
- the maximum number read attempts from the port before returning. A value 0 will result in no reads from the serial port.
The documentation for this class was generated from the following file libraries/include/libhal-util/serial_coroutines.hpp