Module protocol

Module protocol 

Source
Expand description

Defines data structures, constants, and protocol logic for interacting with an 8-Channel temperature module using the Modbus RTU protocol, based on the protocol specification document.

Assumes standard Modbus function codes “Read Holding Registers” (0x03) and “Write Single Register” (0x06) are used externally to interact with the device.

Structs§

Address
Represents a validated Modbus device address, used for RTU communication over RS485.
AutomaticReport
Represents the automatic temperature reporting interval in seconds. A value of 0 disables automatic reporting (query mode). Values 1-255 set the reporting interval in seconds.
Channel
Represents a validated temperature channel index, guaranteed to be within the valid range 0..NUMBER_OF_CHANNELS.
ErrorAddressOutOfRange
Error indicating that a provided Modbus device address (u8) is outside the valid range for assignable addresses, defined by Address::MIN and Address::MAX (inclusive).
ErrorChannelOutOfRange
Error indicating that the channel value is out of range.
ErrorDegreeCelsiusOutOfRange
Error indicating that the degree Celsius value is out of range.
ErrorDurationOutOfRange
Error indicating that a Duration cannot be represented as an AutomaticReport interval (0-255 seconds).
ErrorInvalidBaudRate
Error returned when attempting to create a BaudRate from an unsupported u16 value.
FactoryReset
Represents the factory reset command. This is a write-only operation.
Temperature
Represents a temperature value in degrees Celsius, as read from or written to the R4DCB08.
TemperatureCorrection
Represents the temperature correction values for all 8 channels. Correction values are added to the raw temperature reading. Setting a correction value to 0 disables correction for that channel.
Temperatures
Represents the temperature readings for all 8 channels.

Enums§

BaudRate
Enum representing the supported baud rates for RS485 communication.
Error
A comprehensive error type for all operations within the protocol module.

Constants§

NUMBER_OF_CHANNELS
Number of temperature channels available in the R4DCB08 module.

Type Aliases§

Word
Represents a single 16-bit value stored in a Modbus register.