Skip to main content

Pms7003Sensor

Struct Pms7003Sensor 

Source
pub struct Pms7003Sensor<Serial>
where Serial: Read<u8> + Write<u8>,
{ /* private fields */ }
Expand description

Sensor interface

Implementations§

Source§

impl<Serial> Pms7003Sensor<Serial>
where Serial: Read<u8> + Write<u8>,

Source

pub fn new(serial: Serial) -> Self

Creates a new sensor instance

  • serial - single object implementing embedded hal serial traits
Source

pub fn read(&mut self) -> Result<OutputFrame, Error>

Reads sensor status. Blocks until status is available.

Source

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

Sleep mode. May fail because of incorrect reposnse because of race condition between response and air quality status

Source

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

Source

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

Passive mode - sensor reports air quality on request

Source

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

Active mode - sensor reports air quality continuously

Source

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

Requests status in passive mode

Source§

impl<TX, RX> Pms7003Sensor<Wrapper<TX, RX>>
where TX: Write<u8>, RX: Read<u8>,

Source

pub fn new_tx_rx(tx: TX, rx: RX) -> Self

Creates a new sensor instance

  • tx - embedded hal serial Write
  • rx - embedded hal serial Read

Auto Trait Implementations§

§

impl<Serial> Freeze for Pms7003Sensor<Serial>
where Serial: Freeze,

§

impl<Serial> RefUnwindSafe for Pms7003Sensor<Serial>
where Serial: RefUnwindSafe,

§

impl<Serial> Send for Pms7003Sensor<Serial>
where Serial: Send,

§

impl<Serial> Sync for Pms7003Sensor<Serial>
where Serial: Sync,

§

impl<Serial> Unpin for Pms7003Sensor<Serial>
where Serial: Unpin,

§

impl<Serial> UnsafeUnpin for Pms7003Sensor<Serial>
where Serial: UnsafeUnpin,

§

impl<Serial> UnwindSafe for Pms7003Sensor<Serial>
where Serial: 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.