pub struct TemperatureCorrection(/* private fields */);Expand description
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.
Implementations§
Source§impl TemperatureCorrection
impl TemperatureCorrection
Sourcepub const ADDRESS: u16 = 8u16
pub const ADDRESS: u16 = 8u16
Starting Modbus register address for reading/writing correction values.
Sourcepub const QUANTITY: u16 = 8u16
pub const QUANTITY: u16 = 8u16
Number of Modbus registers required for all channel correction values.
Sourcepub fn decode_from_holding_registers(words: &[Word]) -> Result<Self, Error>
pub fn decode_from_holding_registers(words: &[Word]) -> Result<Self, Error>
Decodes TemperatureCorrection values for all channels from a slice of Modbus holding register values.
Expects a slice containing NUMBER_OF_CHANNELS words.
§Arguments
words- A slice ofWordcontaining the register values for all correction channels.
§Returns
A TemperatureCorrection struct containing the decoded value.
§Errors
Error::UnexpectedDataLength: ifwordsdoes not have length equal toNUMBER_OF_CHANNELS.
Sourcepub fn iter(&self) -> Iter<'_, Temperature>
pub fn iter(&self) -> Iter<'_, Temperature>
Returns an iterator over the individual Temperature correction values.
Sourcepub fn as_slice(&self) -> &[Temperature]
pub fn as_slice(&self) -> &[Temperature]
Returns a slice containing all Temperature correction values.
Sourcepub fn as_array(&self) -> &[Temperature; 8]
pub fn as_array(&self) -> &[Temperature; 8]
Provides direct access to the underlying array of port states.
Sourcepub fn encode_for_write_register(
correction_value: Temperature,
) -> Result<Word, Error>
pub fn encode_for_write_register( correction_value: Temperature, ) -> Result<Word, Error>
Encodes a single Temperature correction value into a Word for writing to the appropriate channel register.
Use channel_address to determine the correct register address for writing.
§Arguments
correction_value- TheTemperaturecorrection value to encode.
§Returns
The Word representation of the correction value.
§Errors
Returns an Error::EncodeError if the correction_value is NAN.
Trait Implementations§
Source§impl Clone for TemperatureCorrection
impl Clone for TemperatureCorrection
Source§fn clone(&self) -> TemperatureCorrection
fn clone(&self) -> TemperatureCorrection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more