pub struct Dht22<Pin, Timer>where
Pin: IOPin,
Timer: MicroTimer,{ /* private fields */ }Expand description
Represents a DHT22 sensor connected to a pin.
Implementations§
Source§impl<Pin, Timer> Dht22<Pin, Timer>
impl<Pin, Timer> Dht22<Pin, Timer>
Sourcepub fn new(pin: Pin, clock: Timer) -> Self
pub fn new(pin: Pin, clock: Timer) -> Self
Construct a new representation of the DHT22 sensor. Construction is cheap as long as the pin and clock are cheap to move.
Sourcepub fn read(&mut self) -> Result<SensorReading, DhtError<Pin::DeviceError>>
pub fn read(&mut self) -> Result<SensorReading, DhtError<Pin::DeviceError>>
Attempt one read from the DHT22 sensor. Between subsequent reads from the same sensor at least 2 seconds should pass to avoid erratic readings. Reading to early after startup may also result in failure to read.
Auto Trait Implementations§
impl<Pin, Timer> Freeze for Dht22<Pin, Timer>
impl<Pin, Timer> RefUnwindSafe for Dht22<Pin, Timer>where
Pin: RefUnwindSafe,
Timer: RefUnwindSafe,
impl<Pin, Timer> Send for Dht22<Pin, Timer>
impl<Pin, Timer> Sync for Dht22<Pin, Timer>
impl<Pin, Timer> Unpin for Dht22<Pin, Timer>
impl<Pin, Timer> UnwindSafe for Dht22<Pin, Timer>where
Pin: UnwindSafe,
Timer: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more