mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 05:45:19 +01:00
rtic-monotonics: Implement blocking DelayUs from embedded-hal 1
This commit is contained in:
parent
54aec9b398
commit
a2ec8f983c
7 changed files with 39 additions and 0 deletions
|
|
@ -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>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue