Struct sgpc3::Sgpc3

source · []
pub struct Sgpc3<I2C, D> { /* private fields */ }

Implementations

Acquires the sensor serial number.

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

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.

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.

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.

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.

Initializes the sensor with preheat.

This is the standard way of initializing the system.

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

Sets the absolute humidity for the best accuracy.

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

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.

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)

Measures TVOC

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

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.

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.

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.

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.

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

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Performs the conversion.

Performs the conversion.

Casts the value.

OverflowingCasts the value.

Should always be Self

Casts the value.

Casts the value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.