adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.12k stars 1.22k forks source link

Implement _dht_read() mini-module to do DHT-sensor-specific reads #4699

Open dhalbert opened 3 years ago

dhalbert commented 3 years ago

As mentioned in https://github.com/adafruit/circuitpython/pull/4689#issuecomment-830649832 and to support #4696, it would be convenient to have a small C module that can do the DHT-style read protocol, without needing the entirety of PulseIn

It would implement just the basic read, like this code in the DHT sensor library. The Python library would take care of all of the decoding, etc.

deshipu commented 3 years ago

Why not call it _1wire_read, as the protocol is called?

ladyada commented 3 years ago

hm cause it isnt 1 wire (?) and weve got something with that name already

dhalbert commented 3 years ago

DHT is a one-wire protocol but is not the "official" "Dallas" one-wire protocol, so it's not compatible. DHT returns 5 bytes; Dallas returns 8 bytes, and I don't know whether the timing is similar in any way.

deshipu commented 3 years ago

Sorry, I was misinformed.