[][src]Struct sgpc3::Sgpc3

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

Implementations

impl<I2C, D, E> Sgpc3<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 serial(&mut self) -> Result<u64, 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_feature_set(&mut self) -> Result<FeatureSet, Error<E>>[src]

Gets the sensor product type and supported feature set.

The sensor uses feature versioning system to indicate the device capabilities. Feature set 5 enables getting TVOC inceptive baseline. Feature set 6 and above enables ultra-low power-save, setting absolute humidity and preheating. The behaviour is undefined when using these functions with sensor not supporting the specific features.

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

Sets sensor into ultra-low power mode.

The SGPC3 offers two operation modes with different power consumptions and sampling intervals. The low-power mode with 1mA average current and 2s sampling interval and the ultra-low power mode with 0.065mA average current and 30s sampling interval. By default, the SGPC3 is using the low-power mode. You want to stick with the sensor sampling internal so you want to take the samples per the internal. The current SW implementation sees ultra low-power mode as one-way street and once entered, one can get only get out of it through resetting the sensor.

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

Sensor self-test.

Performs sensor self-test. This is intended for production line and testing and verification only and shouldn't be needed for normal use. It should not be used after having issues any init commands.

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

Initializes the sensor without preheat.

Initializing without preheat will lead the early samples to be inaccurate. It is the responsibility of the caller to wait the sufficient preheat period.

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

Initializes the sensor with preheat.

This is the standard way of initializing the system.

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

Initializes the sensor with preheat for feature set 5 sensors

This is the standard way of initializing the systems with feature set 5 sensor firmware

pub fn set_absolute_humidity(
    &mut self,
    abs_hum: u32
) -> Result<&mut Self, Error<E>>
[src]

Sets the absolute humidity for the best accuracy.

The argument must be supplied at fixed-point 8.8bit format.

pub fn set_relative_humidity(
    &mut self,
    rh: i32,
    t_mc: i32
) -> Result<&mut Self, Error<E>>
[src]

Sets the relative humidity for the best accuracy.

The arguments are supplied as milli-units. Eg. 20% relative humidity is supplied as 20000 and temperature t_mc as Celsius. 10C is 10000.

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

Measures both TVOC and RAW signal.

The measurement should be performed at the configured sampling internal for the best accuracy. The values are returned as tuple (TVOC, RAW)

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

Measures TVOC

The measurement should be performed at the configured sampling internal for the best accuracy.

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

Measures RAW signal

The measurement should be performed at the configured sampling internal for the best accuracy. Typically, the caller shouldn't need RAW value but should use TVOC instead.

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

Acquired the baseline for faster accurate sampling.

Baseline can be used to reach faster accurate repeatable samples. Sensor must be supporting feature set 6 for the support. Check sensor application note for the usage as you need ensure that sensor has been operating long-enough for valid baseline.

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

Acquired the inceptive baseline for faster accurate sampling.

Baseline can be used to reach faster accurate repeatable samples. This method needs to be used for sensors only supporting feature set 5 instead of using get_tvoc_baseline.

Check sensor application note for the usage as you need ensure that sensor has been operating long-enough for valid baseline.

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

Sets the baseline for faster accurate.

Baseline will ensure that you can start regarding the accuracy where you left it off after powering down or reseting the sensor.

pub fn initialize(
    &mut self,
    baseline: u16,
    baseline_age_s: u32,
    ultra_power_save: bool
) -> Result<&mut Self, Error<E>>
[src]

Initialize sensor for use

Full initialization sequence for common way to initialize the sensor for production use. This code uses the existing functionality making this shortcut to get things going for those who don't want to learn the internal workings of the sensor. This method can only be used with sensors supporting feature set 6 and above.

It is assumed that ['baseline'] has been stored in system non-volatile memory with timestamp during the earlier operation. Datasheet says "If no stored baseline is available after initializing the baseline algorithm, the sensor has to run for 12 hours until the baseline can be stored. This will ensure an optimal behavior for subsequent startups. Reading out the baseline prior should be avoided unless a valid baseline is restored first. Once the baseline is properly initialized or restored, the current baseline value should be stored approximately once per hour. While the sensor is off, baseline values are valid for a maximum of seven days." Baseline age is provided in seconds and set value zero if there is no baseline available.

Initialization can take up to 204s so depending on the application the user may want to run this in own task.

Once the method is complete, the user should immediately take a sample and then continue taking them per the defined power-mode. In ultra power-save, the sampling frequency is 30s and in standard mode 2s.

Trait Implementations

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

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

Auto Trait Implementations

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

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

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

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

impl<I2C, D> UnwindSafe for Sgpc3<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.