[][src]Struct svm40::Svm40

pub struct Svm40<I2C, D> { /* fields omitted */ }

Svm40 main driver to manipulate the sensor

Implementations

impl<I2C, D, E> Svm40<I2C, D> where
    I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,
    D: DelayMs<u32>, 
[src]

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

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

Starts measurement

The device starts measuring continuously providing new sample every 1s. If the user gets the signals earlier, the same values are returned.

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

Stops measurement

Stops running the measurements. The user will need to wait 50ms until the device is ready again.

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

Resets the sensor.

Executes a reset on the device. The caller must wait 100ms before starting to use the device again.

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

Acquires the sensor serial number.

Sensor serial number is only 48-bits long so the remaining 16-bits are zeros.

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

Read the current measured values.

The firmware updates the measurement values every second. Polling data faster will return the same values. The first measurement is available one second after the start measurement command is issued. Any readout prior to this will return zero initialized values.

This method can only be used after calling ['start_measurement'].

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

Returns the new measurement results as integers along with the raw voc ticks and uncompensated RH/T values.

This method reads out VOC Index, relative humidity, and temperature (like ['get_measurements']) and additionally the raw signal of SGP40 (proportional to the logarithm of the resistance of the MOX layer) as well as relative humidity and temperature which are not compensated for temperature offset. The firmware updates the measurement values every second. Polling data faster will return the same values. The first measurement is available on second after the start measurement command is issued. Any readout prior to this will return zero initialized values.

This method can only be used after calling ['start_measurement'].

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

Gets the temperature offset

Gets the temperature compensation offset issues to the device. TODO: For some reason, this functions results CRC error.

pub fn set_temperature_offset(
    &mut self,
    offset: u16
) -> Result<&mut Self, Error<E>>
[src]

Sets the temperature offset.

This command sets the temperature offset used for the compensation of subsequent RHT measurements.RawSignals The parameter provides the temperature offset (in °C) with a scaling factor of 200, e.g., an output of +400 corresponds to +2.00 °C.

pub fn serial(&mut self, serial: &mut [u8; 26]) -> Result<&Self, Error<E>>[src]

Gets the device serial number

Trait Implementations

impl<I2C: Debug, D: Debug> Debug for Svm40<I2C, D>[src]

impl<I2C: Default, D: Default> Default for Svm40<I2C, D>[src]

Auto Trait Implementations

impl<I2C, D> RefUnwindSafe for Svm40<I2C, D> where
    D: RefUnwindSafe,
    I2C: RefUnwindSafe
[src]

impl<I2C, D> Send for Svm40<I2C, D> where
    D: Send,
    I2C: Send
[src]

impl<I2C, D> Sync for Svm40<I2C, D> where
    D: Sync,
    I2C: Sync
[src]

impl<I2C, D> Unpin for Svm40<I2C, D> where
    D: Unpin,
    I2C: Unpin
[src]

impl<I2C, D> UnwindSafe for Svm40<I2C, D> where
    D: UnwindSafe,
    I2C: UnwindSafe
[src]

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.