Description
I have ben working on 'drivers' for a couple of devices that can time out and while the current system works it is very clunky to work with.
To illustrate my problems, here is a usage example in which I ran into some issues. I'm trying to write a driver for the DHT11 and DHT22 temperature and humidity sensors. These sensors communicate using a timing based protocol. Since these timings are specific to the device they should probably be defined in the driver rather than by the user. However, because this crate makes no guarantees about the type of CountDown::Time
it can't be specified for a generic struct.
I would therefore propose adding some time types to the embedded_hal crate which could be used by CountDown
and Periodic
instead. Perhaps lifting the Hertz
, KiloHertz
, and MegaHertz
from stm32f103xx_hal
could work.
Sidenote: Is there a reason that Hertz
is treated as the "base" unit in those crates. It places a hard cap on the amount of time you can wait at 1 second which is slighly annoying.