Sen66

Struct Sen66 

Source
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>

Source

pub fn new(delay: DELAY, i2c: I2C) -> Self

Creates a new SEN66 interface.

  • delay: Delay provider, implementing embedded_hal’s DelayNs trait.
  • i2c: I2C peripheral implementing embedded_hal’s I2c trait.
Source

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

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Measuring state.
Source

pub async fn stop_measurement(&mut self) -> Result<(), Sen66Error<ERR>>

Stops continous measurements. Changes sensors state to Idle. Execution Time: 1000ms

Only available in measuring state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Idle state.
Source

pub async fn is_data_ready(&mut self) -> Result<DataStatus, Sen66Error<ERR>>

Queries whether new data is available. Execution Time: 20ms

Only available in measuring state
§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.
Source

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

Only available in measuring state
§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.
Source

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

Only available in measuring state
§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.
Source

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

Only available in measuring state
§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.
Source

pub async fn set_temperature_offset( &mut self, parameter: TemperatureOffset, ) -> Result<(), Sen66Error<ERR>>

Set the temperature offset parameters.

§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
Source

pub async fn set_temperature_acceleration( &mut self, parameter: TemperatureAcceleration, ) -> Result<(), Sen66Error<ERR>>

Set the temperature acceleration parameters.

Only available in Idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Measuring state.
Source

pub async fn get_product_name(&mut self) -> Result<ProductName, Sen66Error<ERR>>

Read out the sensor’s product name Execution Time: 20ms

§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • DataError: If the received data is corrupted or wrong.
Source

pub async fn get_serial_number( &mut self, ) -> Result<SerialNumber, Sen66Error<ERR>>

Read out the sensor’s serial number Execution Time: 20ms

§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • DataError: If the received data is corrupted or wrong.
Source

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
  • I2cError: If an error on the underlying I2C bus occurs.
  • DataError: If the received data is corrupted or wrong.
Source

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
  • I2cError: If an error on the underlying I2C bus occurs.
  • DataError: If the received data is corrupted or wrong.
Source

pub async fn reset_device(&mut self) -> Result<(), Sen66Error<ERR>>

Reset the sensor, akin to a power cycle. Execution Time: 20ms

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Measuring state.
Source

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

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Measuring state.
Source

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

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Measuring state.
Source

pub async fn get_voc_tuning_parameters( &mut self, ) -> Result<VocTuning, Sen66Error<ERR>>

Read the VocTuning parameters from the sensor. Execution Time: 20ms

Only available in idle state
§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.
Source

pub async fn set_voc_tuning_parameters( &mut self, parameter: VocTuning, ) -> Result<(), Sen66Error<ERR>>

Set the VocTuning parameters for the sensor. Execution Time: 20ms

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Idle state.
Source

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
  • I2cError: If an error on the underlying I2C bus occurs.
  • DataError: If the received data is corrupted or wrong.
Source

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

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Measuring state.
Source

pub async fn get_nox_tuning_parameters( &mut self, ) -> Result<NoxTuning, Sen66Error<ERR>>

Read the NoxTuning parameters from the sensor. Execution Time: 20ms

Only available in idle state
§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.
Source

pub async fn set_nox_tuning_parameters( &mut self, parameter: NoxTuning, ) -> Result<(), Sen66Error<ERR>>

Set the NoxTuning parameters for the sensor. Execution Time: 20ms

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Idle state.
Source

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

Only available in idle state
§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.
Source

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

Only available in idle state
§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.
Source

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

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Idle state.
Source

pub async fn get_ambient_pressure( &mut self, ) -> Result<AmbientPressure, Sen66Error<ERR>>

Read the configured ambient pressure for CO2 sensor compensation from the sensor. Execution Time: 20ms

§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • DataError: If the received data is corrupted or wrong.
Source

pub async fn set_ambient_pressure( &mut self, parameter: AmbientPressure, ) -> Result<(), Sen66Error<ERR>>

Configure the ambient pressure for CO2 sensor compensation for the sensor. Execution Time: 20ms

§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
Source

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

Only available in idle state
§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.
Source

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

Only available in idle state
§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
  • WrongState: If the command is called in Idle state.
Source

pub async fn shutdown(self) -> Result<(DELAY, I2C), Sen66Error<ERR>>

Closes the sensor interface, stops active measuring if active and returns the contained peripherals.

§Errors
  • I2cError: If an error on the underlying I2C bus occurs.
Source

pub async fn kill(self) -> (DELAY, I2C)

Closes the sensor interface, does not change sensor state.

Auto Trait Implementations§

§

impl<DELAY, I2C> Freeze for Sen66<DELAY, I2C>
where DELAY: Freeze, I2C: Freeze,

§

impl<DELAY, I2C> RefUnwindSafe for Sen66<DELAY, I2C>
where DELAY: RefUnwindSafe, I2C: RefUnwindSafe,

§

impl<DELAY, I2C> Send for Sen66<DELAY, I2C>
where DELAY: Send, I2C: Send,

§

impl<DELAY, I2C> Sync for Sen66<DELAY, I2C>
where DELAY: Sync, I2C: Sync,

§

impl<DELAY, I2C> Unpin for Sen66<DELAY, I2C>
where DELAY: Unpin, I2C: Unpin,

§

impl<DELAY, I2C> UnwindSafe for Sen66<DELAY, I2C>
where DELAY: UnwindSafe, I2C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.