[][src]Struct hal_sensor_dht::DHTSensor

pub struct DHTSensor<P, T, I> where
    P: OutputPin + InputPin + IoPin,
    T: DelayUs<u16> + DelayMs<u16>,
    I: InterruptCtrl
{ /* fields omitted */ }

Interface for the DHT sensor.

Implementations

impl<P, T, I> DHTSensor<P, T, I> where
    P: OutputPin + InputPin + IoPin,
    T: DelayUs<u16> + DelayMs<u16>,
    I: InterruptCtrl
[src]

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

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.

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

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

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

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

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.