pub struct OneShotTimer<'d, T> { /* private fields */ }Expand description
A one-shot timer.
Implementations§
Source§impl<'d, T> OneShotTimer<'d, T>where
T: Timer,
impl<'d, T> OneShotTimer<'d, T>where
T: Timer,
Sourcepub fn new(inner: impl Peripheral<P = T> + 'd) -> Self
pub fn new(inner: impl Peripheral<P = T> + 'd) -> Self
Construct a new instance of OneShotTimer.
Sourcepub fn delay_millis(&self, ms: u32)
pub fn delay_millis(&self, ms: u32)
Pauses execution for at least ms milliseconds.
Sourcepub fn delay_micros(&self, us: u32)
pub fn delay_micros(&self, us: u32)
Pauses execution for at least us microseconds.
Sourcepub fn delay_nanos(&self, ns: u32)
pub fn delay_nanos(&self, ns: u32)
Pauses execution for at least ns nanoseconds.
Sourcepub fn schedule(&mut self, timeout: MicrosDurationU64) -> Result<(), Error>
pub fn schedule(&mut self, timeout: MicrosDurationU64) -> Result<(), Error>
Start counting until the given timeout and raise an interrupt
Sourcepub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Set the interrupt handler
Note that this will replace any previously set interrupt handler
Sourcepub fn enable_interrupt(&mut self, enable: bool)
pub fn enable_interrupt(&mut self, enable: bool)
Enable listening for interrupts
Sourcepub fn clear_interrupt(&mut self)
pub fn clear_interrupt(&mut self)
Clear the interrupt flag
Trait Implementations§
Source§impl<T> DelayNs for OneShotTimer<'_, T>where
T: Timer,
impl<T> DelayNs for OneShotTimer<'_, T>where
T: Timer,
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.Source§impl<T> InterruptConfigurable for OneShotTimer<'_, T>where
T: Timer,
impl<T> InterruptConfigurable for OneShotTimer<'_, T>where
T: Timer,
Source§fn set_interrupt_handler(&mut self, handler: InterruptHandler)
fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Set the interrupt handler Read more
Source§impl<T, UXX> DelayMs<UXX> for OneShotTimer<'_, T>
impl<T, UXX> DelayMs<UXX> for OneShotTimer<'_, T>
Auto Trait Implementations§
impl<'d, T> Freeze for OneShotTimer<'d, T>where
T: Freeze,
impl<'d, T> RefUnwindSafe for OneShotTimer<'d, T>where
T: RefUnwindSafe,
impl<'d, T> Send for OneShotTimer<'d, T>where
T: Send,
impl<'d, T> Sync for OneShotTimer<'d, T>where
T: Sync,
impl<'d, T> Unpin for OneShotTimer<'d, T>where
T: Unpin,
impl<'d, T> !UnwindSafe for OneShotTimer<'d, T>
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