rtic-monotonics: Implement blocking DelayUs from embedded-hal 1

This commit is contained in:
Nils Fitinghoff 2023-09-14 16:47:52 +02:00 committed by Emil Fresk
parent 54aec9b398
commit a2ec8f983c
7 changed files with 39 additions and 0 deletions

View file

@ -230,6 +230,13 @@ macro_rules! make_timer {
}
}
impl embedded_hal::delay::DelayUs for $mono_name {
fn delay_us(&mut self, us: u32) {
let done = Self::now() + (us as u64).micros();
while Self::now() < done {}
}
}
impl Monotonic for $mono_name {
type Instant = fugit::TimerInstantU64<TIMER_HZ>;
type Duration = fugit::TimerDurationU64<TIMER_HZ>;