pub struct OneShotTimer<'a> { /* private fields */ }Expand description
One-shot timer wrapper.
Counts down from a loaded value and stops when it reaches zero.
Implementations§
Source§impl OneShotTimer<'_>
impl OneShotTimer<'_>
Sourcepub fn start(&mut self, count: u32)
pub fn start(&mut self, count: u32)
Start the one-shot timer with a count value.
count is in timer clock ticks (TCXO = 24MHz → 1 tick ≈ 41.7ns).
Sourcepub fn start_micros(&mut self, us: u32)
pub fn start_micros(&mut self, us: u32)
Start the timer for the given duration in microseconds.
Max duration: ~178 seconds at 24MHz (u32 ticks limit).
For longer durations, use start_millis() or loop start_micros().
Sourcepub fn start_millis(&mut self, ms: u32)
pub fn start_millis(&mut self, ms: u32)
Start the timer for the given duration in milliseconds.
Max duration: ~178,956ms (~178s) at 24MHz. For longer durations, repeat this call in a loop.
Trait Implementations§
Source§impl DelayNs for OneShotTimer<'_>
impl DelayNs for OneShotTimer<'_>
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<'a> Freeze for OneShotTimer<'a>
impl<'a> RefUnwindSafe for OneShotTimer<'a>
impl<'a> Send for OneShotTimer<'a>
impl<'a> Sync for OneShotTimer<'a>
impl<'a> Unpin for OneShotTimer<'a>
impl<'a> UnsafeUnpin for OneShotTimer<'a>
impl<'a> UnwindSafe for OneShotTimer<'a>
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