[][src]Struct shtcx::ShtCx

pub struct ShtCx<S: ShtSensor, I2C> { /* fields omitted */ }

Driver for the SHTCx sensor.

To create an instance of this, use a factory function like shtc1 or shtc3 depending on your sensor.

Implementations

impl<S, I2C, E> ShtCx<S, I2C> where
    S: ShtSensor,
    I2C: Read<Error = E> + Write<Error = E>, 
[src]

General functions.

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

Destroy driver instance, return I²C bus instance.

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

Return the raw ID register.

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

Return the 7-bit device identifier.

Should be 0x47 (71) for the SHTC3 and 0x07 (7) for the SHTC1.

pub fn reset(&mut self, delay: &mut impl DelayUs<u16>) -> Result<(), Error<E>>[src]

Trigger a soft reset.

The SHTC3 provides a soft reset mechanism that forces the system into a well-defined state without removing the power supply. If the system is in its idle state (i.e. if no measurement is in progress) the soft reset command can be sent. This triggers the sensor to reset all internal state machines and reload calibration data from the memory.

impl<S, I2C, E> ShtCx<S, I2C> where
    S: ShtSensor,
    I2C: Read<Error = E> + Write<Error = E>, 
[src]

Asynchronous functions for starting / reading measurements.

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

Start a temperature / humidity measurement.

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

Read the result of a temperature / humidity measurement.

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

Start a temperature measurement.

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

Read the result of a temperature measurement.

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

Start a humidity measurement.

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

Read the result of a humidity measurement.

impl<S, I2C, E> ShtCx<S, I2C> where
    S: ShtSensor + MeasurementDuration,
    I2C: Read<Error = E> + Write<Error = E>, 
[src]

Blocking functions for doing measurements.

pub fn wait_for_measurement(
    &mut self,
    mode: PowerMode,
    delay: &mut impl DelayUs<u16>
)
[src]

Wait the maximum time needed for the given measurement mode

pub fn measure(
    &mut self,
    mode: PowerMode,
    delay: &mut impl DelayUs<u16>
) -> Result<Measurement, Error<E>>
[src]

Run a temperature/humidity measurement and return the combined result.

This is a blocking function call.

pub fn measure_temperature(
    &mut self,
    mode: PowerMode,
    delay: &mut impl DelayUs<u16>
) -> Result<Temperature, Error<E>>
[src]

Run a temperature measurement and return the result.

This is a blocking function call.

Internally, it will request a measurement in "temperature first" mode and only read the first half of the measurement response.

pub fn measure_humidity(
    &mut self,
    mode: PowerMode,
    delay: &mut impl DelayUs<u16>
) -> Result<Humidity, Error<E>>
[src]

Run a humidity measurement and return the result.

This is a blocking function call.

Internally, it will request a measurement in "humidity first" mode and only read the first half of the measurement response.

Trait Implementations

impl<S: Debug + ShtSensor, I2C: Debug> Debug for ShtCx<S, I2C>[src]

impl<S: Default + ShtSensor, I2C: Default> Default for ShtCx<S, I2C>[src]

impl<I2C, E> LowPower<E> for ShtCx<Sht2Gen, I2C> where
    I2C: Read<Error = E> + Write<Error = E>, 
[src]

impl<I2C, E> LowPower<E> for ShtCx<ShtGeneric, I2C> where
    I2C: Read<Error = E> + Write<Error = E>, 
[src]

Auto Trait Implementations

impl<S, I2C> RefUnwindSafe for ShtCx<S, I2C> where
    I2C: RefUnwindSafe,
    S: RefUnwindSafe

impl<S, I2C> Send for ShtCx<S, I2C> where
    I2C: Send,
    S: Send

impl<S, I2C> Sync for ShtCx<S, I2C> where
    I2C: Sync,
    S: Sync

impl<S, I2C> Unpin for ShtCx<S, I2C> where
    I2C: Unpin,
    S: Unpin

impl<S, I2C> UnwindSafe for ShtCx<S, I2C> where
    I2C: UnwindSafe,
    S: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.