|
Alicat BASIS-2 Driver 1.0.0
API reference
|
CRTP base for the BASIS-2 serial transport. More...
#include <alicat_basis2_uart_interface.hpp>
Public Member Functions | |
| void | write (const uint8_t *data, std::size_t length) noexcept |
Send length bytes synchronously. | |
| std::size_t | read (uint8_t *out, std::size_t max, uint32_t timeout_ms) noexcept |
Read up to max bytes into out with a per-call timeout. | |
| void | flush_rx () noexcept |
| Drop any unread bytes from the RX path. | |
| void | delay_ms (uint32_t ms) noexcept |
Sleep at least ms milliseconds. | |
| template<typename... Args> | |
| void | log (const char *tag, const char *fmt, Args... args) noexcept |
| Optional logging hook, printf-style. | |
CRTP base for the BASIS-2 serial transport.
| Derived | The concrete adapter (e.g. AlicatUartEspAdapter). |
The driver dispatches every byte through static_cast<Derived*>(this), so there is zero virtual-call overhead. The compiler can fully inline the adapter calls into the driver's read/write loops.
|
inlinenoexcept |
Sleep at least ms milliseconds.
Calls Derived::delay_ms_impl(ms) when the adapter has one (public, or private with friend class UartInterface<Derived>; any cv/ref qualifier). Otherwise a no-op: there is no portable time base to busy-wait on.
|
inlinenoexcept |
Drop any unread bytes from the RX path.
|
inlinenoexcept |
Optional logging hook, printf-style.
Forwards tag, fmt and the arguments unchanged to Derived::log_impl(tag, fmt, args...) when the adapter has one; otherwise a no-op. The driver logs every failed transaction here with the tag "alicat_basis2"; fmt is always a string literal.
|
inlinenoexcept |
Read up to max bytes into out with a per-call timeout.
out.
|
inlinenoexcept |
Send length bytes synchronously.
Must block until all bytes are accepted by the underlying serial driver.