[][src]Function dht_hal_drv::dht_read

pub fn dht_read<IO_PIN>(
    dht: DhtType,
    open_pin: &mut IO_PIN,
    delay_us: &mut dyn FnMut(u16)
) -> Result<DhtValue, DhtError> where
    IO_PIN: InputPin + OutputPin

Read DHT sensor via open drain (open collector) pin or its emulation.

DHT sensor communication designed to use open drain like pin with pull up resistor. Some hardware does not have open drain pins but it is possible to emulate it in this case set_high() should convert pin into input floating mode.

If you have slow CPU clocks speed you may need to read data without delays at all. Thus you should use dht_split_* functions instead and pass an empty closure to dht_split_read.

Arguments

  • dht - DHT sensor type we are reading
  • open_pin - Open drain like pin
  • delay_us - Closure where you should call appropriate delay/sleep/whatever API with microseconds as input.