pub struct MhZ19C<'a, U, E>where
U: Read<u8, Error = E> + Write<u8, Error = E>,{ /* private fields */ }
Expand description
Driver for the MH-Z19C sensor.
Implementations§
source§impl<'a, U, E> MhZ19C<'a, U, E>where
U: Read<u8, Error = E> + Write<u8, Error = E>,
impl<'a, U, E> MhZ19C<'a, U, E>where U: Read<u8, Error = E> + Write<u8, Error = E>,
sourcepub fn read_co2_ppm(&mut self) -> Result<u16, Error<E>>
pub fn read_co2_ppm(&mut self) -> Result<u16, Error<E>>
Reads and returns the CO₂ concentration in parts-per-million (ppm).
sourcepub fn get_firmware_version(&mut self) -> Result<[u8; 4], Error<E>>
pub fn get_firmware_version(&mut self) -> Result<[u8; 4], Error<E>>
Retrieves the firmware version of the sensor.
sourcepub fn set_self_calibrate(&mut self, enabled: bool) -> Result<(), Error<E>>
pub fn set_self_calibrate(&mut self, enabled: bool) -> Result<(), Error<E>>
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.
sourcepub fn into_inner(self) -> U
pub fn into_inner(self) -> U
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
).
sourcepub fn upgrade_to_v5<'b>(
&'b mut self
) -> Result<MhZ19CFw5<'a, 'b, U, E>, Error<E>>
pub fn upgrade_to_v5<'b>( &'b mut self ) -> Result<MhZ19CFw5<'a, 'b, U, E>, Error<E>>
Will make the Firmware5Api
capabilities available.
If the sensor firmware is not at least of version 5, an error will be returned.