pub struct Sen66<DELAY, I2C> { /* private fields */ }Expand description
Interface for the SEN66.
Implementations§
Source§impl<DELAY: DelayNs, I2C: I2c<Error = ERR>, ERR: Error> Sen66<DELAY, I2C>
impl<DELAY: DelayNs, I2C: I2c<Error = ERR>, ERR: Error> Sen66<DELAY, I2C>
Sourcepub fn new(delay: DELAY, i2c: I2C) -> Self
pub fn new(delay: DELAY, i2c: I2C) -> Self
Creates a new SEN66 interface.
delay: Delay provider, implementing embedded_hal’sDelayNstrait.i2c: I2C peripheral implementing embedded_hal’sI2ctrait.
Sourcepub async fn start_measurement(&mut self) -> Result<(), Sen66Error<ERR>>
pub async fn start_measurement(&mut self) -> Result<(), Sen66Error<ERR>>
Starts a continous measurement. The first result is available after roughly 1.1s
use is_data_ready to poll for available measurements.
Changes sensors state to Measuring.
Execution Time: 50ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Measuring state.
Sourcepub async fn stop_measurement(&mut self) -> Result<(), Sen66Error<ERR>>
pub async fn stop_measurement(&mut self) -> Result<(), Sen66Error<ERR>>
Stops continous measurements.
Changes sensors state to Idle.
Execution Time: 1000ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.
Sourcepub async fn is_data_ready(&mut self) -> Result<DataStatus, Sen66Error<ERR>>
pub async fn is_data_ready(&mut self) -> Result<DataStatus, Sen66Error<ERR>>
Queries whether new data is available. Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn read_measured_values(
&mut self,
) -> Result<Measurement, Sen66Error<ERR>>
pub async fn read_measured_values( &mut self, ) -> Result<Measurement, Sen66Error<ERR>>
Read a Measurement value from the sensor.
If new data is available clears the data ready flag. If no new data is available
the previous data point is returned. If no data at all is available all values are
set to their maximum value.
Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn read_measured_raw_values(
&mut self,
) -> Result<RawMeasurement, Sen66Error<ERR>>
pub async fn read_measured_raw_values( &mut self, ) -> Result<RawMeasurement, Sen66Error<ERR>>
Read a RawMeasurement value from the sensor.
If new data is available clears the data ready flag. If no new data is available
the previous data point is returned. If no data at all is available all values are
set to their maximum value.
Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn read_number_concentrations(
&mut self,
) -> Result<Concentrations, Sen66Error<ERR>>
pub async fn read_number_concentrations( &mut self, ) -> Result<Concentrations, Sen66Error<ERR>>
Read a Concentrations value from the sensor.
If new data is available clears the data ready flag. If no new data is available
the previous data point is returned. If no data at all is available all values are
set to their maximum value.
Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn set_temperature_offset(
&mut self,
parameter: TemperatureOffset,
) -> Result<(), Sen66Error<ERR>>
pub async fn set_temperature_offset( &mut self, parameter: TemperatureOffset, ) -> Result<(), Sen66Error<ERR>>
Set the temperature offset parameters.
parameter: SeeTemperatureOffsetExecution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.
Sourcepub async fn set_temperature_acceleration(
&mut self,
parameter: TemperatureAcceleration,
) -> Result<(), Sen66Error<ERR>>
pub async fn set_temperature_acceleration( &mut self, parameter: TemperatureAcceleration, ) -> Result<(), Sen66Error<ERR>>
Set the temperature acceleration parameters.
parameter: SeeTemperatureAccelerationExecution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Measuring state.
Sourcepub async fn get_product_name(&mut self) -> Result<ProductName, Sen66Error<ERR>>
pub async fn get_product_name(&mut self) -> Result<ProductName, Sen66Error<ERR>>
Sourcepub async fn get_serial_number(
&mut self,
) -> Result<SerialNumber, Sen66Error<ERR>>
pub async fn get_serial_number( &mut self, ) -> Result<SerialNumber, Sen66Error<ERR>>
Sourcepub async fn read_device_status(
&mut self,
) -> Result<DeviceStatusRegister, Sen66Error<ERR>>
pub async fn read_device_status( &mut self, ) -> Result<DeviceStatusRegister, Sen66Error<ERR>>
Read out the sensor’s DeviceStatusRegister.
Error flags are untouched by this.
Execution Time: 20ms
§Errors
Sourcepub async fn read_and_clear_device_status(
&mut self,
) -> Result<DeviceStatusRegister, Sen66Error<ERR>>
pub async fn read_and_clear_device_status( &mut self, ) -> Result<DeviceStatusRegister, Sen66Error<ERR>>
Read out the sensor’s DeviceStatusRegister and
reset flags stored within.
Execution Time: 20ms
§Errors
Sourcepub async fn reset_device(&mut self) -> Result<(), Sen66Error<ERR>>
pub async fn reset_device(&mut self) -> Result<(), Sen66Error<ERR>>
Reset the sensor, akin to a power cycle. Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Measuring state.
Sourcepub async fn start_fan_cleaning(&mut self) -> Result<(), Sen66Error<ERR>>
pub async fn start_fan_cleaning(&mut self) -> Result<(), Sen66Error<ERR>>
Start the fan cleaning procedure. The fan is set to maximum speed for 10s and then stopped. After issuing this command wait at least 10s before starting a measurement. Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Measuring state.
Sourcepub async fn activate_sht_heater(&mut self) -> Result<(), Sen66Error<ERR>>
pub async fn activate_sht_heater(&mut self) -> Result<(), Sen66Error<ERR>>
Activate the SHT heater. The heater runs with 200mW for 1s. Wait at least 20s after the command for the heat to disapper, before taking the next measurement. Execution Time: 1300ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Measuring state.
Sourcepub async fn get_voc_tuning_parameters(
&mut self,
) -> Result<VocTuning, Sen66Error<ERR>>
pub async fn get_voc_tuning_parameters( &mut self, ) -> Result<VocTuning, Sen66Error<ERR>>
Read the VocTuning parameters from the sensor.
Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn set_voc_tuning_parameters(
&mut self,
parameter: VocTuning,
) -> Result<(), Sen66Error<ERR>>
pub async fn set_voc_tuning_parameters( &mut self, parameter: VocTuning, ) -> Result<(), Sen66Error<ERR>>
Set the VocTuning parameters for the sensor.
Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.
Sourcepub async fn get_voc_algorithm_state(
&mut self,
) -> Result<VocAlgorithmState, Sen66Error<ERR>>
pub async fn get_voc_algorithm_state( &mut self, ) -> Result<VocAlgorithmState, Sen66Error<ERR>>
Read the VocAlgorithmState parameters
from the sensor.
The VOC algorithm state is lost after a device reset or power cycle, this enables
storing it persistently and using
set_voc_algorithm_state to restore it.
Can be read every measurement.
Execution Time: 20ms
§Errors
Sourcepub async fn set_voc_algorithm_state(
&mut self,
parameter: VocAlgorithmState,
) -> Result<(), Sen66Error<ERR>>
pub async fn set_voc_algorithm_state( &mut self, parameter: VocAlgorithmState, ) -> Result<(), Sen66Error<ERR>>
Set the VocAlgorithmState parameters
for the sensor.
Use get_voc_algorithm_state to retrive it.
Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Measuring state.
Sourcepub async fn get_nox_tuning_parameters(
&mut self,
) -> Result<NoxTuning, Sen66Error<ERR>>
pub async fn get_nox_tuning_parameters( &mut self, ) -> Result<NoxTuning, Sen66Error<ERR>>
Read the NoxTuning parameters from the sensor.
Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn set_nox_tuning_parameters(
&mut self,
parameter: NoxTuning,
) -> Result<(), Sen66Error<ERR>>
pub async fn set_nox_tuning_parameters( &mut self, parameter: NoxTuning, ) -> Result<(), Sen66Error<ERR>>
Set the NoxTuning parameters for the sensor.
Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.
Sourcepub async fn perform_forced_co2_recalibration(
&mut self,
parameter: TargetCO2Concentration,
) -> Result<Co2Correction, Sen66Error<ERR>>
pub async fn perform_forced_co2_recalibration( &mut self, parameter: TargetCO2Concentration, ) -> Result<Co2Correction, Sen66Error<ERR>>
Execute the forced recalibration (FRC) for the CO2 sensor. Wait at least 1000ms after power-on or 600ms after stopping the measurement before issuing this command. Execution Time: 500ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn get_co2_asc_state(&mut self) -> Result<AscState, Sen66Error<ERR>>
pub async fn get_co2_asc_state(&mut self) -> Result<AscState, Sen66Error<ERR>>
Read out whether the automatic self calibration (ASC) for the CO2 sensor is enabled or disabled. Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn set_co2_asc_state(
&mut self,
new_state: AscState,
) -> Result<(), Sen66Error<ERR>>
pub async fn set_co2_asc_state( &mut self, new_state: AscState, ) -> Result<(), Sen66Error<ERR>>
Set whether the automatic self calibration (ASC) for the CO2 sensor is enabled or disabled. Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.
Sourcepub async fn get_ambient_pressure(
&mut self,
) -> Result<AmbientPressure, Sen66Error<ERR>>
pub async fn get_ambient_pressure( &mut self, ) -> Result<AmbientPressure, Sen66Error<ERR>>
Sourcepub async fn set_ambient_pressure(
&mut self,
parameter: AmbientPressure,
) -> Result<(), Sen66Error<ERR>>
pub async fn set_ambient_pressure( &mut self, parameter: AmbientPressure, ) -> Result<(), Sen66Error<ERR>>
Sourcepub async fn get_sensor_altitude(
&mut self,
) -> Result<SensorAltitude, Sen66Error<ERR>>
pub async fn get_sensor_altitude( &mut self, ) -> Result<SensorAltitude, Sen66Error<ERR>>
Read the configured sensor altitude for CO2 sensor compensation from the sensor. Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.DataError: If the received data is corrupted or wrong.
Sourcepub async fn set_sensor_altitude(
&mut self,
parameter: SensorAltitude,
) -> Result<(), Sen66Error<ERR>>
pub async fn set_sensor_altitude( &mut self, parameter: SensorAltitude, ) -> Result<(), Sen66Error<ERR>>
Configure the sensor altitude for CO2 sensor compensation for the sensor. Execution Time: 20ms
§Errors
I2cError: If an error on the underlying I2C bus occurs.WrongState: If the command is called in Idle state.
Sourcepub async fn shutdown(self) -> Result<(DELAY, I2C), Sen66Error<ERR>>
pub async fn shutdown(self) -> Result<(DELAY, I2C), Sen66Error<ERR>>
Sourcepub async fn kill(self) -> (DELAY, I2C)
pub async fn kill(self) -> (DELAY, I2C)
Closes the sensor interface, does not change sensor state.