|
| uint16_t | Crc16 (const uint8_t *data, std::size_t length) noexcept |
| | Compute the Modbus-RTU CRC-16 over a byte buffer.
|
| |
| std::size_t | AppendCrc (uint8_t *frame, std::size_t length) noexcept |
| | Append the CRC-16 to frame[length..length+1] and return new length.
|
| |
| bool | CheckCrc (const uint8_t *frame, std::size_t length) noexcept |
| | Verify the CRC at frame[length-2..length-1] matches the body.
|
| |
| std::size_t | BuildReadHolding (uint8_t unit_addr, uint16_t reg_addr, uint16_t reg_count, uint8_t *out, std::size_t out_capacity) noexcept |
| | Build a Function-03 (Read Holding Registers) request.
|
| |
| std::size_t | BuildWriteSingle (uint8_t unit_addr, uint16_t reg_addr, uint16_t value, uint8_t *out, std::size_t out_capacity) noexcept |
| | Build a Function-06 (Write Single Register) request.
|
| |
| std::size_t | BuildWriteMultiple (uint8_t unit_addr, uint16_t reg_addr, const uint16_t *regs, uint8_t count, uint8_t *out, std::size_t out_capacity) noexcept |
| | Build a Function-16 (Write Multiple Registers) request.
|
| |
| constexpr uint32_t | InterFrameGapUs (uint32_t bps) noexcept |
| | Minimum idle time t3.5 between two Modbus-RTU frames, in microseconds.
|
| |
| constexpr uint32_t | InterFrameGapMs (uint32_t bps) noexcept |
| | InterFrameGapUs(bps) rounded up to whole milliseconds (for UartInterface::delay_ms()).
|
| |
| bool | IsExceptionReply (const uint8_t *frame, std::size_t length) noexcept |
| |
| DriverError | ParseException (const uint8_t *frame, std::size_t length, uint8_t expected_addr, uint8_t expected_fn, uint8_t *code) noexcept |
| | Parse a 5-byte exception reply (Modbus Application Protocol V1.1b3, section 7).
|
| |
| DriverError | ParseReadHolding (const uint8_t *frame, std::size_t length, uint8_t expected_addr, uint8_t expected_count, uint16_t *regs) noexcept |
| | Parse a Function-03 response into regs[].
|
| |
| DriverError | ParseWriteSingleEcho (const uint8_t *frame, std::size_t length, const uint8_t *request, std::size_t req_len) noexcept |
| | Validate the echo of a Function-06 (Write Single) request against the just-sent request.
|
| |
| DriverError | ParseWriteMultipleEcho (const uint8_t *frame, std::size_t length, uint8_t expected_addr, uint16_t expected_reg_addr, uint16_t expected_count) noexcept |
| | Validate the response of a Function-16 (Write Multiple) request.
|
| |
|
| constexpr uint32_t | kRtuBitsPerChar = 11 |
| | Bits per RTU character used for the timing: start + 8 data + parity/stop + stop (section 2.5.1).
|
| |
| constexpr uint32_t | kFixedGapAboveBps = 19200 |
| | Above this baud rate the spec fixes t3.5 at 1750 us instead of 3.5 character times.
|
| |
| constexpr uint32_t | kFixedGapUs = 1750 |
| | The fixed t3.5 used above 19200 baud, in microseconds.
|
| |
| constexpr std::size_t | kExceptionFrameLength = 5 |
| | Length of a Modbus-RTU exception reply: address, function | 0x80, exception code, CRC-16.
|
| |
| constexpr std::size_t | kReplyHeaderLength = 3 |
| | Number of reply bytes a receiver reads before it can tell an exception reply (bit 7 of the function code set) from a normal one: address, function code, and one more byte.
|
| |