pub struct Delay<TIM, const FREQ: u32>(/* private fields */);
Expand description
Periodic non-blocking timer that implements embedded_hal_02::blocking::delay traits.
§Example: Millisecond precision
To instantiate this with the TIM2 timer and millisecond precision:
let mut delay = dp.TIM2.delay_ms(&clocks);
delay.delay_ms(320_u32);
With millisecond precision, you can wait from 2 ms to 49 days.
§Example: Microsecond precision
To instantiate this with the TIM5 timer and microsecond precision:
let delay = dp.TIM5.delay_us(&clocks);
delay.delay_us(30_u32);
delay.delay_ms(5_u32);
delay.delay(5.millis());
delay.delay(3.secs());
With microsecond precision, you can wait from 2 µs to 71 min.
Implementations§
Methods from Deref<Target = FTimer<T, FREQ>>§
pub fn set_master_mode(&mut self, mode: TIM::Mms)
Trait Implementations§
Source§impl<TIM: Instance, const FREQ: u32> DelayNs for Delay<TIM, FREQ>
impl<TIM: Instance, const FREQ: u32> DelayNs for Delay<TIM, FREQ>
Source§fn delay_ns(&mut self, ns: u32)
fn delay_ns(&mut self, ns: u32)
Pauses execution for at minimum
ns
nanoseconds. Pause can be longer
if the implementation requires it due to precision/timing issues.Auto Trait Implementations§
impl<TIM, const FREQ: u32> Freeze for Delay<TIM, FREQ>where
TIM: Freeze,
impl<TIM, const FREQ: u32> RefUnwindSafe for Delay<TIM, FREQ>where
TIM: RefUnwindSafe,
impl<TIM, const FREQ: u32> Send for Delay<TIM, FREQ>where
TIM: Send,
impl<TIM, const FREQ: u32> Sync for Delay<TIM, FREQ>where
TIM: Sync,
impl<TIM, const FREQ: u32> Unpin for Delay<TIM, FREQ>where
TIM: Unpin,
impl<TIM, const FREQ: u32> UnwindSafe for Delay<TIM, FREQ>where
TIM: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more