embedded-time
embedded-time copied to clipboard
Add implementation for embedded_hal::blocking::delay::Delay trait
How about adding Clock::delay(&self) -> impl Delay function (maybe behind feature gate)?
It could be useful as currently many hal crates only provides SysTick based delay.
I will make a PR if you like.
I'm not seeing a Delay trait in embedded-hal. It does have DelayUs and DelayMs. These could possibly be implemented, but I think the proper implementation would be for Timer. I'm thinking something like this:
impl<'a, Clock: crate::Clock, Dur: Duration> embedded_hal::blocking::delay::DelayMs<Clock::T>
for Timer<'a, OneShot, Armed, Clock, Dur>
{
fn delay_ms(&mut self, ms: <Clock as crate::Clock>::T) {
unimplemented!()
}
}
It's been a while since I've worked on this code, but I think we could wrap a timer in the Clock trait.
Yes, DelayMs and DelayUs.
I thought that Timer is for constant duration...