|
Alicat BASIS-2 Driver 1.0.0
API reference
|
CRTP serial transport for the Alicat BASIS-2 driver. More...
#include <cstdint>#include <cstddef>#include <type_traits>Go to the source code of this file.
Classes | |
| class | alicat_basis2::UartInterface< Derived > |
| CRTP base for the BASIS-2 serial transport. More... | |
Namespaces | |
| namespace | alicat_basis2 |
CRTP serial transport for the Alicat BASIS-2 driver.
The driver itself only deals in byte buffers. Each platform (ESP-IDF, mock test harness, embedded MCU project, …) provides a concrete adapter inheriting from this CRTP base, implementing three small methods:
void write(const uint8_t* data, std::size_t length); std::size_t read(uint8_t* out, std::size_t max, uint32_t timeout_ms); void flush_rx();
and, optionally, two hooks the base class finds at compile time:
void delay_ms_impl(uint32_t ms); // sleep >= ms void log_impl(const char* tag, const char* fmt, ...); // printf-style
Without delay_ms_impl, delay_ms() does nothing: portable code has no time base to busy-wait on. The driver calls delay_ms() before every request to leave the Modbus-RTU 3.5-character idle gap (Modbus over Serial Line V1.02, section 2.5.1.1), so a port without the hook must leave the gap itself (in write() or in the UART). Without log_impl, log() does nothing; the driver logs every failed transaction through it.
Concrete adapters should map RS-485 DE/RE handling (when needed) onto the underlying UART driver's RS-485 mode before passing the adapter to the BASIS-2 driver.