pub struct Timer<TIM> { /* private fields */ }
Expand description
Timer wrapper
Implementations§
Source§impl Timer<SYST>
impl Timer<SYST>
Sourcepub fn counter_hz(self) -> SysCounterHz
pub fn counter_hz(self) -> SysCounterHz
Creates SysCounterHz which takes Hertz as Duration
Sourcepub fn counter<const FREQ: u32>(self) -> SysCounter<FREQ>
pub fn counter<const FREQ: u32>(self) -> SysCounter<FREQ>
Creates SysCounter with custom precision (core frequency recommended is known)
Sourcepub fn counter_us(self) -> SysCounterUs
pub fn counter_us(self) -> SysCounterUs
Creates SysCounter 1 microsecond precision
Source§impl Timer<SYST>
impl Timer<SYST>
Source§impl<TIM: Instance> Timer<TIM>
impl<TIM: Instance> Timer<TIM>
pub fn configure(&mut self, clocks: &Clocks)
pub fn counter_hz(self) -> CounterHz<TIM>
pub fn release(self) -> TIM
Sourcepub fn listen(&mut self, event: Event)
pub fn listen(&mut self, event: Event)
Starts listening for an event
Note, you will also have to enable the TIM2 interrupt in the NVIC to start receiving events.
Sourcepub fn clear_interrupt(&mut self, event: Event)
pub fn clear_interrupt(&mut self, event: Event)
Clears interrupt associated with event
.
If the interrupt is not cleared, it will immediately retrigger after the ISR has finished.
pub fn get_interrupt(&mut self) -> Event
Sourcepub fn stop_in_debug(&mut self, dbg: &mut DBG, state: bool)
pub fn stop_in_debug(&mut self, dbg: &mut DBG, state: bool)
Stopping timer in debug mode can cause troubles when sampling the signal
Auto Trait Implementations§
impl<TIM> Freeze for Timer<TIM>where
TIM: Freeze,
impl<TIM> RefUnwindSafe for Timer<TIM>where
TIM: RefUnwindSafe,
impl<TIM> Send for Timer<TIM>where
TIM: Send,
impl<TIM> Sync for Timer<TIM>where
TIM: Sync,
impl<TIM> Unpin for Timer<TIM>where
TIM: Unpin,
impl<TIM> UnwindSafe for Timer<TIM>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