pub struct Timer<T: TimerInterface> { /* private fields */ }Expand description
Generic timer object allowing blocking wait and interrupt enablement.
Implementations§
Source§impl<T: TimerInterface> Timer<T>
impl<T: TimerInterface> Timer<T>
Sourcepub fn wait(&self, duration: Duration)
pub fn wait(&self, duration: Duration)
Blocking waits for a duration or maximal possible timer. The timer must be enabled before calling wait.
Sourcepub fn remaining_time(&self) -> Duration
pub fn remaining_time(&self) -> Duration
Returns the downcounter value as a duration.
Sourcepub fn set_remaining_time(&mut self, duration: Duration)
pub fn set_remaining_time(&mut self, duration: Duration)
Sets the remaining timer duration.
If the duration converted to ticks overflows i32, TVAL will be set to i32::MAX ticks.
Sourcepub fn enable_interrupt(&mut self)
pub fn enable_interrupt(&mut self)
Unmasks interrupts for this timer.
Interrupts and output signals will only be emitted if Self::enable() has been called.
Sourcepub fn disable_interrupt(&mut self)
pub fn disable_interrupt(&mut self)
Masks interrupts for this timer.
Trait Implementations§
Source§impl<T: TimerInterface> DelayNs for Timer<T>
Available on crate feature embedded-hal only.
impl<T: TimerInterface> DelayNs for Timer<T>
Available on crate feature
embedded-hal only.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<T> Freeze for Timer<T>where
T: Freeze,
impl<T> RefUnwindSafe for Timer<T>where
T: RefUnwindSafe,
impl<T> Send for Timer<T>where
T: Send,
impl<T> Sync for Timer<T>where
T: Sync,
impl<T> Unpin for Timer<T>where
T: Unpin,
impl<T> UnsafeUnpin for Timer<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Timer<T>where
T: 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