HardFOC Core
API reference
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
HalUartFdo2Comm Class Reference

CRTP adapter that turns a BaseUart& into a transport the templated fdo2::Driver<UartT> can drive. More...

#include <Fdo2Handler.h>

Inheritance diagram for HalUartFdo2Comm:

Public Member Functions

 HalUartFdo2Comm (BaseUart &uart) noexcept
 
void write (const std::uint8_t *data, std::size_t length) noexcept
 
std::size_t read (std::uint8_t *out, std::size_t max, std::uint32_t timeout_ms) noexcept
 
void flush_rx () noexcept
 
void delay_ms_impl (std::uint32_t ms) noexcept
 

Private Attributes

BaseUart & uart_
 
std::uint8_t line_ [128] {}
 Reply being assembled; 128 bytes holds the longest reply (#MRAW with CRC, < 120).
 
std::size_t line_len_ {0}
 

Detailed Description

CRTP adapter that turns a BaseUart& into a transport the templated fdo2::Driver<UartT> can drive.

Notes
  • read() returns one complete reply line, CR included, as the driver requires (a line without its CR is a ProtocolError), or 0 when no whole line arrived within the timeout. A partial line is kept for the next call; flush_rx() drops it. BaseUart::Read reports a status, not a count, so bytes are read one at a time while BytesAvailable() is non-zero.
  • All timing (delays, deadline tracking) goes through the hf-utils-rtos-wrap os_* primitives — the handler has zero direct ESP-IDF / FreeRTOS dependencies, so the same code path works against any RTOS the wrapper supports.

Constructor & Destructor Documentation

◆ HalUartFdo2Comm()

HalUartFdo2Comm::HalUartFdo2Comm ( BaseUart &  uart)
inlineexplicitnoexcept

Member Function Documentation

◆ delay_ms_impl()

void HalUartFdo2Comm::delay_ms_impl ( std::uint32_t  ms)
noexcept

◆ flush_rx()

void HalUartFdo2Comm::flush_rx ( )
noexcept

◆ read()

std::size_t HalUartFdo2Comm::read ( std::uint8_t *  out,
std::size_t  max,
std::uint32_t  timeout_ms 
)
noexcept

◆ write()

void HalUartFdo2Comm::write ( const std::uint8_t *  data,
std::size_t  length 
)
noexcept

Member Data Documentation

◆ line_

std::uint8_t HalUartFdo2Comm::line_[128] {}
private

Reply being assembled; 128 bytes holds the longest reply (#MRAW with CRC, < 120).

◆ line_len_

std::size_t HalUartFdo2Comm::line_len_ {0}
private

◆ uart_

BaseUart& HalUartFdo2Comm::uart_
private

The documentation for this class was generated from the following files: