Struct mh_z19c::MhZ19C[][src]

pub struct MhZ19C<'a, U, E> where
    U: Read<u8, Error = E> + Write<u8, Error = E>, 
{ /* fields omitted */ }

Driver for the MH-Z19C sensor.

Implementations

impl<'a, U, E> MhZ19C<'a, U, E> where
    U: Read<u8, Error = E> + Write<u8, Error = E>, 
[src]

pub fn new(uart: U) -> Self[src]

Create a new instance.

  • uart: Serial (UART) interface for communication with the sensor.

pub fn into_inner(self) -> U[src]

Returns the owned UART interface.vec!

Note that this might leave the interface with partially written or read bytes on the UART interface if not all MH-Z19C commands have been polled to completion (i.e. the last command call did not return nb::Error::WouldBlock).

pub fn read_co2_ppm(&mut self) -> Result<u16, Error<E>>[src]

Reads and returns the CO₂ concentration in parts-per-million (ppm).

pub fn set_self_calibrate(&mut self, enabled: bool) -> Result<(), Error<E>>[src]

Activates or deactivates the sensor’s self-calibration mode.

See the sensor’s data sheet for more information on self-calibration and hand-operated mode.

Trait Implementations

impl<'a, U: Debug, E: Debug> Debug for MhZ19C<'a, U, E> where
    U: Read<u8, Error = E> + Write<u8, Error = E>, 
[src]

Auto Trait Implementations

impl<'a, U, E> RefUnwindSafe for MhZ19C<'a, U, E> where
    U: RefUnwindSafe

impl<'a, U, E> Send for MhZ19C<'a, U, E> where
    U: Send

impl<'a, U, E> Sync for MhZ19C<'a, U, E> where
    U: Sync

impl<'a, U, E> Unpin for MhZ19C<'a, U, E> where
    U: Unpin

impl<'a, U, E> UnwindSafe for MhZ19C<'a, U, E> where
    U: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.