[][src]Struct tmp1x2::Tmp1x2

pub struct Tmp1x2<I2C, MODE> { /* fields omitted */ }

TMP1X2 device driver.

Methods

impl<I2C, E> Tmp1x2<I2C, Continuous> where
    I2C: Write<Error = E>, 
[src]

pub fn into_one_shot(
    self
) -> Result<Tmp1x2<I2C, OneShot>, ModeChangeError<E, Self>>
[src]

Change into one-shot conversion mode (shutdown).

If the mode change failed you will get a ModeChangeError. You can get the unchanged device back from it.

impl<I2C, E> Tmp1x2<I2C, OneShot> where
    I2C: Write<Error = E>, 
[src]

pub fn into_continuous(
    self
) -> Result<Tmp1x2<I2C, Continuous>, ModeChangeError<E, Self>>
[src]

Change into continuous conversion mode.

If the mode change failed you will get a ModeChangeError. You can get the unchanged device back from it.

impl<I2C, E, MODE> Tmp1x2<I2C, MODE> where
    I2C: Write<Error = E>, 
[src]

pub fn enable_extended_mode(&mut self) -> Result<(), Error<E>>[src]

Enable the extended measurement mode.

This allows measurement of temperatures above 128°C.

pub fn disable_extended_mode(&mut self) -> Result<(), Error<E>>[src]

Disable the extended measurement mode.

This puts the device in normal measurement mode. It will not measure temperatures above 128°C.

pub fn set_conversion_rate(&mut self, rate: CR) -> Result<(), Error<E>>[src]

Set the conversion rate when in continuous conversion mode.

pub fn set_high_temperature_threshold(
    &mut self,
    temperature: f32
) -> Result<(), Error<E>>
[src]

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.

pub fn set_low_temperature_threshold(
    &mut self,
    temperature: f32
) -> Result<(), Error<E>>
[src]

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.

pub fn set_fault_queue(&mut self, fq: FaultQueue) -> Result<(), Error<E>>[src]

Set the fault queue.

Set the number of consecutive faults that will trigger an alert.

pub fn set_alert_polarity(
    &mut self,
    polarity: AlertPolarity
) -> Result<(), Error<E>>
[src]

Set the alert polarity.

pub fn set_thermostat_mode(
    &mut self,
    mode: ThermostatMode
) -> Result<(), Error<E>>
[src]

Set the thermostat mode.

pub fn reset_internal_driver_state(&mut self)[src]

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.

impl<I2C, E> Tmp1x2<I2C, Continuous> where
    I2C: WriteRead<Error = E>, 
[src]

pub fn read_temperature(&mut self) -> Result<f32, Error<E>>[src]

Read the temperature from the sensor.

impl<I2C, E> Tmp1x2<I2C, OneShot> where
    I2C: WriteRead<Error = E> + Write<Error = E>, 
[src]

pub fn read_temperature(&mut self) -> Result<f32, Error<E>>[src]

Perform a one-shot temperature measurement.

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.

If no temperature conversion was started yet, calling this method will start one and return nb::Error::WouldBlock. Subsequent calls will continue to return nb::Error::WouldBlock until the temperature measurement is finished. Then it will return the measured temperature.

impl<I2C, E, MODE> Tmp1x2<I2C, MODE> where
    I2C: WriteRead<Error = E>, 
[src]

pub fn is_comparator_mode_alert_active(&mut self) -> Result<bool, Error<E>>[src]

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.

impl<I2C, E> Tmp1x2<I2C, Continuous> where
    I2C: Write<Error = E>, 
[src]

pub fn new(i2c: I2C, address: SlaveAddr) -> Self[src]

Create new instance of the TMP102 or TMP112x device.

By default they are in continuous conversion mode.

impl<I2C, MODE> Tmp1x2<I2C, MODE>[src]

pub fn destroy(self) -> I2C[src]

Destroy driver instance, return I²C bus instance.

Trait Implementations

impl<I2C: Debug, MODE: Debug> Debug for Tmp1x2<I2C, MODE>[src]

impl<I2C: Default, MODE: Default> Default for Tmp1x2<I2C, MODE>[src]

Auto Trait Implementations

impl<I2C, MODE> Send for Tmp1x2<I2C, MODE> where
    I2C: Send,
    MODE: Send

impl<I2C, MODE> Sync for Tmp1x2<I2C, MODE> where
    I2C: Sync,
    MODE: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]