|
BASIS 2 Driver 0.1.0
API reference
|
The Modbus RTU codec (M pp.18 to 27): CRC-16, request builders, response parser and the second wire validator. More...
#include <array>#include <cstddef>#include <cstdint>#include <span>#include "alicat_basis2_registers.hpp"#include "alicat_basis2_request.hpp"#include "alicat_basis2_types.hpp"Go to the source code of this file.
Classes | |
| struct | alicat_basis2::modbus::Response |
| A parsed Modbus response. More... | |
Namespaces | |
| namespace | alicat_basis2 |
The ALICAT_BASIS2 driver: everything it declares lives here; internals in detail. | |
| namespace | alicat_basis2::modbus |
| The Modbus RTU codec. | |
Functions | |
| constexpr uint16_t | alicat_basis2::modbus::Crc16 (std::span< const uint8_t > data) noexcept |
| Modbus CRC-16 (polynomial 0xA001 reflected, initial value 0xFFFF). | |
| Result< Request > | alicat_basis2::modbus::BuildRead (uint8_t address, uint16_t first, uint16_t count) noexcept |
| Build a function 3 request. | |
| Result< Request > | alicat_basis2::modbus::BuildWriteSingle (uint8_t address, uint16_t target, uint16_t value) noexcept |
| Build a function 6 request (one register). | |
| Result< Request > | alicat_basis2::modbus::BuildWriteMultiple (uint8_t address, uint16_t target, uint32_t value) noexcept |
| Build a function 16 request for a two-register item (32-bit value, high register first). | |
| bool | alicat_basis2::modbus::IsLegalModbusRequest (std::span< const uint8_t > bytes) noexcept |
Whether bytes is exactly one request the driver may send: a valid CRC, an address 1 to 247, function 3 on readable registers, function 6 or 16 on writable registers with a legal value. | |
| std::size_t | alicat_basis2::modbus::ReplyLength (std::span< const char > bytes) noexcept |
| How long the reply frame is, as far as the bytes received so far tell. | |
| Error | alicat_basis2::modbus::ParseResponse (std::span< const char > frame, uint8_t request_address, uint8_t request_function, std::span< const uint8_t > request_bytes, Response &out) noexcept |
| Parse and validate a response frame. | |
The Modbus RTU codec (M pp.18 to 27): CRC-16, request builders, response parser and the second wire validator.
Only functions 3 (read holding registers), 6 (write single) and 16 (write multiple) are ever built, only on the registers of reg::kRegisters, only with the documented value ranges and magic numbers, and never to address 0 (broadcast, A13) or above 247. Registers are big-endian; the CRC is sent low byte first.