DHTSensor

Struct DHTSensor 

Source
pub struct DHTSensor<P, T, I>{ /* private fields */ }
Expand description

Interface for the DHT sensor.

Implementations§

Source§

impl<P, T, I> DHTSensor<P, T, I>

Source

pub fn new(sensor: SensorType, p: P, t: T, i: I) -> DHTSensor<P, T, I>

Constructs a new DHTSensor.

The following arguments need to be provided:

  • sensor the DHT sensor type.
  • p - a pin which can act as InputPin, OutputPin and IoPin
  • t - a timer which implements DelayMs and DelayUs.
  • i - an interrupt controller, which is used to disable the interrupt while reading the input line.
Source

pub fn read(&mut self) -> Result<Reading, DhtError>

Reads the input line and returns the temperature and humidity.

Note that the calling function should obey the timing requirements for the used sensor. So do not call this function without any delay between the readings.

Auto Trait Implementations§

§

impl<P, T, I> Freeze for DHTSensor<P, T, I>
where P: Freeze, T: Freeze, I: Freeze,

§

impl<P, T, I> RefUnwindSafe for DHTSensor<P, T, I>

§

impl<P, T, I> Send for DHTSensor<P, T, I>
where P: Send, T: Send, I: Send,

§

impl<P, T, I> Sync for DHTSensor<P, T, I>
where P: Sync, T: Sync, I: Sync,

§

impl<P, T, I> Unpin for DHTSensor<P, T, I>
where P: Unpin, T: Unpin, I: Unpin,

§

impl<P, T, I> UnwindSafe for DHTSensor<P, T, I>
where P: UnwindSafe, T: UnwindSafe, I: 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.