pub struct Tmp1x2<I2C> { /* private fields */ }
Expand description
TMP1X2 device driver.
Implementations
sourceimpl<I2C, E> Tmp1x2<I2C>where
I2C: Write<Error = E>,
impl<I2C, E> Tmp1x2<I2C>where
I2C: Write<Error = E>,
sourcepub fn enable_extended_mode(&mut self) -> Result<(), Error<E>>
pub fn enable_extended_mode(&mut self) -> Result<(), Error<E>>
Enable the extended measurement mode.
This allows measurement of temperatures above 128°C.
sourcepub fn disable_extended_mode(&mut self) -> Result<(), Error<E>>
pub fn disable_extended_mode(&mut self) -> Result<(), Error<E>>
Disable the extended measurement mode.
This puts the device in normal measurement mode. It will not measure temperatures above 128°C.
sourcepub fn trigger_one_shot_measurement(&mut self) -> Result<(), Error<E>>
pub fn trigger_one_shot_measurement(&mut self) -> Result<(), Error<E>>
Trigger a one-shot measurement when in shutdown mode (disabled).
This allows triggering a single temperature measurement when in shutdown mode. The device returns to the shutdown state at the completion of the temperature conversion. This reduces power consumption when continuous temperature monitoring is not required.
See also: is_one_shot_measurement_result_ready()
sourcepub fn set_conversion_rate(&mut self, rate: CR) -> Result<(), Error<E>>
pub fn set_conversion_rate(&mut self, rate: CR) -> Result<(), Error<E>>
Set the conversion rate when in continuous conversion mode.
sourcepub fn set_high_temperature_threshold(
&mut self,
temperature: f32
) -> Result<(), Error<E>>
pub fn set_high_temperature_threshold(
&mut self,
temperature: f32
) -> Result<(), Error<E>>
Set the high temperature threshold.
The value provided will be capped to be in the interval
[-128.0, 127.9375]
in normal mode and [-256.0, 255.875]
in
extended mode.
sourcepub fn set_low_temperature_threshold(
&mut self,
temperature: f32
) -> Result<(), Error<E>>
pub fn set_low_temperature_threshold(
&mut self,
temperature: f32
) -> Result<(), Error<E>>
Set the low temperature threshold.
The value provided will be capped to be in the interval
[-128.0, 127.9375]
in normal mode and [-256.0, 255.875]
in
extended mode.
sourcepub fn set_fault_queue(&mut self, fq: FaultQueue) -> Result<(), Error<E>>
pub fn set_fault_queue(&mut self, fq: FaultQueue) -> Result<(), Error<E>>
Set the fault queue.
Set the number of consecutive faults that will trigger an alert.
sourcepub fn set_alert_polarity(
&mut self,
polarity: AlertPolarity
) -> Result<(), Error<E>>
pub fn set_alert_polarity(
&mut self,
polarity: AlertPolarity
) -> Result<(), Error<E>>
Set the alert polarity.
sourcepub fn set_thermostat_mode(
&mut self,
mode: ThermostatMode
) -> Result<(), Error<E>>
pub fn set_thermostat_mode(
&mut self,
mode: ThermostatMode
) -> Result<(), Error<E>>
Set the thermostat mode.
sourcepub fn reset_internal_driver_state(&mut self)
pub fn reset_internal_driver_state(&mut self)
Reset the internal state of this driver to the default values.
Note: This does not alter the state or configuration of the device.
This resets the cached configuration register value in this driver to the power-up (reset) configuration of the device.
This needs to be called after performing a reset on the device, for example through an I2C general-call Reset command, which was not done through this driver to ensure that the configurations in the device and in the driver match.
sourceimpl<I2C, E> Tmp1x2<I2C>where
I2C: WriteRead<Error = E>,
impl<I2C, E> Tmp1x2<I2C>where
I2C: WriteRead<Error = E>,
sourcepub fn read_temperature(&mut self) -> Result<f32, Error<E>>
pub fn read_temperature(&mut self) -> Result<f32, Error<E>>
Read the temperature from the sensor.
sourcepub fn is_one_shot_measurement_result_ready(&mut self) -> Result<bool, Error<E>>
pub fn is_one_shot_measurement_result_ready(&mut self) -> Result<bool, Error<E>>
Read whether the one-shot measurement result is ready.
See also: trigger_one_shot_measurement()
sourcepub fn is_comparator_mode_alert_active(&mut self) -> Result<bool, Error<E>>
pub fn is_comparator_mode_alert_active(&mut self) -> Result<bool, Error<E>>
Read whether an alert is active as defined by the comparator mode.
NOTE: This ignores the thermostat mode setting and always corresponds to the activation status as defined by the comparator mode.
This method takes into account the alert polarity selected.
See also: ThermostatMode, AlertPolarity.