DHT11

Struct DHT11 

Source
pub struct DHT11<PIN, STATE> { /* private fields */ }

Implementations§

Source§

impl<PIN, E> DHT11<PIN, Idle>
where PIN: InputPin<Error = E> + OutputPin<Error = E>,

Source

pub fn new(pin: PIN) -> DHT11<PIN, Uninitialized>

Source

pub fn new_and_initialized( pin: PIN, delay: &mut impl DelayNs, ) -> Result<DHT11<PIN, Initialized>, E>

Creates and initializes the sensor in one go. ⚠️ WARNING: This is a blocking call that takes ~3 seconds to complete.

Source§

impl<PIN, E> DHT11<PIN, Uninitialized>
where PIN: InputPin<Error = E> + OutputPin<Error = E>,

Source

pub fn initialize( self, delay: &mut impl DelayNs, ) -> Result<DHT11<PIN, Initialized>, E>

Initializes the sensor with required power-on delays ⚠️ WARNING: Wait at least 2 seconds after initialization before reading the sensor

Source§

impl<PIN, E> DHT11<PIN, Initialized>
where PIN: InputPin<Error = E> + OutputPin<Error = E>,

Source

pub fn read_temp_and_hum( &mut self, delay: &mut impl DelayNs, ) -> Result<Measurement, E>

Reads temperature and humidity from the sensor

Auto Trait Implementations§

§

impl<PIN, STATE> Freeze for DHT11<PIN, STATE>
where PIN: Freeze,

§

impl<PIN, STATE> RefUnwindSafe for DHT11<PIN, STATE>
where PIN: RefUnwindSafe, STATE: RefUnwindSafe,

§

impl<PIN, STATE> Send for DHT11<PIN, STATE>
where PIN: Send, STATE: Send,

§

impl<PIN, STATE> Sync for DHT11<PIN, STATE>
where PIN: Sync, STATE: Sync,

§

impl<PIN, STATE> Unpin for DHT11<PIN, STATE>
where PIN: Unpin, STATE: Unpin,

§

impl<PIN, STATE> UnwindSafe for DHT11<PIN, STATE>
where PIN: UnwindSafe, STATE: 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.