Struct sgp30::Sgp30

source ·
pub struct Sgp30<I2C, D> { /* private fields */ }
Expand description

Driver for the SGP30

Implementations§

Create a new instance of the SGP30 driver.

Destroy driver instance, return I²C bus instance.

Return the 48 bit serial number of the SGP30.

Run an on-chip self-test. Return a boolean indicating whether the test succeeded.

Initialize the air quality measurement.

The SGP30 uses a dynamic baseline compensation algorithm and on-chip calibration parameters to provide two complementary air quality signals.

Calling this method starts the air quality measurement. After initializing the measurement, the measure() method must be called in regular intervals of 1 s to ensure proper operation of the dynamic baseline compensation algorithm. It is the responsibility of the user of this driver to ensure that these periodic measurements are being done.

For the first 15 s after initializing the air quality measurement, the sensor is in an initialization phase during which it returns fixed values of 400 ppm CO₂eq and 0 ppb TVOC. After 15 s (15 measurements) the values should start to change.

A new init command has to be sent after every power-up or soft reset.

Like init(), but without checking whether the sensor is already initialized.

This might be necessary after a sensor soft or hard reset.

Get an air quality measurement.

Before calling this method, the air quality measurements must have been initialized using the init() method. Otherwise an Error::NotInitialized will be returned.

Once the measurements have been initialized, the measure() method must be called in regular intervals of 1 s to ensure proper operation of the dynamic baseline compensation algorithm. It is the responsibility of the user of this driver to ensure that these periodic measurements are being done.

For the first 15 s after initializing the air quality measurement, the sensor is in an initialization phase during which it returns fixed values of 400 ppm CO₂eq and 0 ppb TVOC. After 15 s (15 measurements) the values should start to change.

Return sensor raw signals.

This command is intended for part verification and testing purposes. It returns the raw signals which are used as inputs for the on-chip calibration and baseline compensation algorithm. The command performs a measurement to which the sensor responds with the two signals for H2 and Ethanol.

Return the baseline values of the baseline correction algorithm.

The SGP30 provides the possibility to read and write the baseline values of the baseline correction algorithm. This feature is used to save the baseline in regular intervals on an external non-volatile memory and restore it after a new power-up or soft reset of the sensor.

This function returns the baseline values for the two air quality signals. These two values should be stored on an external memory. After a power-up or soft reset, the baseline of the baseline correction algorithm can be restored by calling init() followed by set_baseline().

Set the baseline values for the baseline correction algorithm.

Before calling this method, the air quality measurements must have been initialized using the init() method. Otherwise an Error::NotInitialized will be returned.

The SGP30 provides the possibility to read and write the baseline values of the baseline correction algorithm. This feature is used to save the baseline in regular intervals on an external non-volatile memory and restore it after a new power-up or soft reset of the sensor.

This function sets the baseline values for the two air quality signals.

Set the humidity value for the baseline correction algorithm.

The SGP30 features an on-chip humidity compensation for the air quality signals (CO₂eq and TVOC) and sensor raw signals (H2 and Ethanol). To use the on-chip humidity compensation, an absolute humidity value from an external humidity sensor is required.

After setting a new humidity value, this value will be used by the on-chip humidity compensation algorithm until a new humidity value is set. Restarting the sensor (power-on or soft reset) or calling the function with a None value sets the humidity value used for compensation to its default value (11.57 g/m³) until a new humidity value is sent.

Before calling this method, the air quality measurements must have been initialized using the init() method. Otherwise an Error::NotInitialized will be returned.

Get the feature set.

The SGP30 features a versioning system for the available set of measurement commands and on-chip algorithms. This so called feature set version number can be read out with this method.

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
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

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.