Struct Sps30

Source
pub struct Sps30<I2C, D> { /* private fields */ }
Expand description

SPS30 device driver

Implementations§

Source§

impl<I2C, D, E> Sps30<I2C, D>
where I2C: Read<Error = E> + Write<Error = E>, D: DelayMs<u8>,

Source

pub fn new_sps30(i2c: I2C, delay: D) -> Self

Create new instance of the SPS30 device

Source

pub fn destroy(self) -> I2C

Destory driver instance

Source

pub fn start_measurement(&mut self) -> Result<(), Error<E>>

Enter measurement mode Command execution time: 20 ms

Source

pub fn stop_measurement(&mut self) -> Result<(), Error<E>>

Exit measurement mode Command execution time: 20 ms

Source

pub fn read_data_ready_flag(&mut self) -> Result<bool, Error<E>>

Poll for the availability of new measurements Command execution time: -

Source

pub fn read_measured_values(&mut self) -> Result<AirInfo, Error<E>>

Read the measured values Command execution time: -

Source

pub fn sleep(&mut self) -> Result<(), Error<E>>

Enter sleep mode Command execution time: 5 ms

Source

pub fn wake_up(&mut self) -> Result<(), Error<E>>

Exit sleep mode Command execution time: 5 ms

Source

pub fn start_fan_cleaning(&mut self) -> Result<(), Error<E>>

Start the fan-cleaning manually This commmand can only be executed in Measurement-Mode Command execution time: 5 ms

Source

pub fn read_auto_cleaning_interval(&mut self) -> Result<u32, Error<E>>

Read the interval[s] of the periodic fan-cleaning Command execution time: 5 ms

Source

pub fn write_auto_cleaning_interval(&mut self, n: u32) -> Result<(), Error<E>>

Write the interval[s] of the periodic fan-cleaning Command execution time: 20 ms

Source

pub fn read_device_product_type(&mut self) -> Result<[u8; 8], Error<E>>

Read device product type Command execution time: -

Source

pub fn read_device_serial_number(&mut self) -> Result<[u8; 32], Error<E>>

Read device serial number Command execution time: -

Source

pub fn read_firmware_version(&mut self) -> Result<(u8, u8), Error<E>>

Read firmware version Command execution time: -

Source

pub fn read_device_status_register( &mut self, ) -> Result<StatusRegisterResult, Error<E>>

Read device status register Command execution time: -

Source

pub fn clear_device_status_register(&mut self) -> Result<(), Error<E>>

Clear device status register Command execution time: 5 ms

Source

pub fn device_reset(&mut self) -> Result<(), Error<E>>

Reset the device Command execution time: 100 ms

Auto Trait Implementations§

§

impl<I2C, D> Freeze for Sps30<I2C, D>
where I2C: Freeze, D: Freeze,

§

impl<I2C, D> RefUnwindSafe for Sps30<I2C, D>

§

impl<I2C, D> Send for Sps30<I2C, D>
where I2C: Send, D: Send,

§

impl<I2C, D> Sync for Sps30<I2C, D>
where I2C: Sync, D: Sync,

§

impl<I2C, D> Unpin for Sps30<I2C, D>
where I2C: Unpin, D: Unpin,

§

impl<I2C, D> UnwindSafe for Sps30<I2C, D>
where I2C: UnwindSafe, D: 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.