Skip to content

Class hal::read_uint32

ClassList > hal > read_uint32

Read bytes from serial port and convert to integer.

  • #include <serial_coroutines.hpp>

Public Functions

Type Name
std::optional< uint32_t > get ()
result< work_state > operator() ()
parse serial data and convert to an integer
read_uint32 (serial & p_serial, size_t p_read_limit=32)
Construct a new read_uint32 object.

Public Functions Documentation

function get

inline std::optional< uint32_t > hal::read_uint32::get () 

Returns:

std::optional<uint32_t> - integer if the parsing is finished or std::nullopt

function operator()

parse serial data and convert to an integer

inline result< work_state > hal::read_uint32::operator() () 

This function will return if an integer ws found or 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 an integer hasn't been found

Returns:

result<work_state> - work_state::finished - integer has been found and a non-integer byte has also been found.

function read_uint32

Construct a new read_uint32 object.

inline hal::read_uint32::read_uint32 (
    serial & p_serial,
    size_t p_read_limit=32
) 

Parameters:

  • p_serial - serial port to skip through
  • p_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