[−][src]Struct shtcx::ShtCx
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]
S: ShtSensor,
I2C: Read<Error = E> + Write<Error = E>,
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]
S: ShtSensor,
I2C: Read<Error = E> + Write<Error = E>,
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]
&mut self,
mode: PowerMode
) -> Result<(), Error<E>>
Start a temperature measurement.
pub fn get_temperature_measurement_result(
&mut self
) -> Result<Temperature, Error<E>>
[src]
&mut self
) -> Result<Temperature, Error<E>>
Read the result of a temperature measurement.
pub fn start_humidity_measurement(
&mut self,
mode: PowerMode
) -> Result<(), Error<E>>
[src]
&mut self,
mode: PowerMode
) -> Result<(), Error<E>>
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]
S: ShtSensor + MeasurementDuration,
I2C: Read<Error = E> + Write<Error = E>,
Blocking functions for doing measurements.
pub fn wait_for_measurement(
&mut self,
mode: PowerMode,
delay: &mut impl DelayUs<u16>
)
[src]
&mut self,
mode: PowerMode,
delay: &mut impl DelayUs<u16>
)
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]
&mut self,
mode: PowerMode,
delay: &mut impl DelayUs<u16>
) -> Result<Measurement, Error<E>>
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]
&mut self,
mode: PowerMode,
delay: &mut impl DelayUs<u16>
) -> Result<Temperature, Error<E>>
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]
&mut self,
mode: PowerMode,
delay: &mut impl DelayUs<u16>
) -> Result<Humidity, Error<E>>
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]
I2C: Read<Error = E> + Write<Error = E>,
const WAKEUP_TIME_US: u16
[src]
fn sleep(&mut self) -> Result<(), Error<E>>
[src]
fn start_wakeup(&mut self) -> Result<(), Error<E>>
[src]
fn wakeup(&mut self, delay: &mut impl DelayUs<u16>) -> Result<(), Error<E>>
[src]
impl<I2C, E> LowPower<E> for ShtCx<ShtGeneric, I2C> where
I2C: Read<Error = E> + Write<Error = E>,
[src]
I2C: Read<Error = E> + Write<Error = E>,
Auto Trait Implementations
impl<S, I2C> RefUnwindSafe for ShtCx<S, I2C> where
I2C: RefUnwindSafe,
S: RefUnwindSafe,
I2C: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, I2C> Send for ShtCx<S, I2C> where
I2C: Send,
S: Send,
I2C: Send,
S: Send,
impl<S, I2C> Sync for ShtCx<S, I2C> where
I2C: Sync,
S: Sync,
I2C: Sync,
S: Sync,
impl<S, I2C> Unpin for ShtCx<S, I2C> where
I2C: Unpin,
S: Unpin,
I2C: Unpin,
S: Unpin,
impl<S, I2C> UnwindSafe for ShtCx<S, I2C> where
I2C: UnwindSafe,
S: UnwindSafe,
I2C: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,