Struct svm40::Svm40[][src]

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.

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

Based on the output, it looks like serial number could be turned into string. API is kept as binary for time being to avoid pulling in std libraries

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

Gets VOC states

The returned value can be used to set the states (using the ['set_voc_states command'] after resuming sensor operation, e.g., after a short interruption by skipping the initial learning phase of the VOC Algorithm.

pub fn set_voc_states(&mut self, data: u64) -> Result<&Self, Error<E>>[src]

Set VOC states

This sets the states of the VOC Algorithm state, which were retrieved by the ['set_voc_states'] command before. This can be used when resuming sensor operation, e.g., after a short interruption by skipping the initial learning phase of the VOC Algorithm.

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

Stores the issues parameters

This command stores all parameters previously sent to the slave via the ['set_temperature_offset'] and/or the ['set_voc_parameters'] commands to the non-volatile memory of SVM40. These parameters will not be erased during reset and will be used by the corresponding algorithms after start-up. To reset the storage to factory settings the master has to set all parameters to the default values followed by a subsequent call of the ['store_input_parameters'] command.

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

Acquires VOC parameters

Four 2 byte parameters are returned as one u64 that were used to configure VOC Algorithm

pub fn set_voc_parameters(&mut self, data: u64) -> Result<&Self, Error<E>>[src]

Sets VOC parameters

The parameters are used to tune VOC Algorithm. Consult the vendor for the details.

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.