Struct Timer

Source
pub struct Timer<TIM> { /* private fields */ }
Expand description

Timer wrapper

Implementations§

Source§

impl Timer<TIM1>

Source

pub fn qei<REMAP, PINS>( self, pins: PINS, mapr: &mut MAPR, options: QeiOptions, ) -> Qei<TIM1, REMAP, PINS>
where REMAP: Remap<Periph = TIM1>, PINS: Pins<REMAP>,

Source§

impl Timer<TIM2>

Source

pub fn qei<REMAP, PINS>( self, pins: PINS, mapr: &mut MAPR, options: QeiOptions, ) -> Qei<TIM2, REMAP, PINS>
where REMAP: Remap<Periph = TIM2>, PINS: Pins<REMAP>,

Source§

impl Timer<TIM3>

Source

pub fn qei<REMAP, PINS>( self, pins: PINS, mapr: &mut MAPR, options: QeiOptions, ) -> Qei<TIM3, REMAP, PINS>
where REMAP: Remap<Periph = TIM3>, PINS: Pins<REMAP>,

Source§

impl Timer<TIM4>

Source

pub fn qei<REMAP, PINS>( self, pins: PINS, mapr: &mut MAPR, options: QeiOptions, ) -> Qei<TIM4, REMAP, PINS>
where REMAP: Remap<Periph = TIM4>, PINS: Pins<REMAP>,

Source§

impl Timer<TIM1>

Source

pub fn pwm_input<REMAP, PINS>( self, pins: PINS, mapr: &mut MAPR, dbg: &mut DBG, mode: Configuration, ) -> PwmInput<TIM1, REMAP, PINS>
where REMAP: Remap<Periph = TIM1>, PINS: Pins<REMAP>,

Source§

impl Timer<TIM2>

Source

pub fn pwm_input<REMAP, PINS>( self, pins: PINS, mapr: &mut MAPR, dbg: &mut DBG, mode: Configuration, ) -> PwmInput<TIM2, REMAP, PINS>
where REMAP: Remap<Periph = TIM2>, PINS: Pins<REMAP>,

Source§

impl Timer<TIM3>

Source

pub fn pwm_input<REMAP, PINS>( self, pins: PINS, mapr: &mut MAPR, dbg: &mut DBG, mode: Configuration, ) -> PwmInput<TIM3, REMAP, PINS>
where REMAP: Remap<Periph = TIM3>, PINS: Pins<REMAP>,

Source§

impl Timer<TIM4>

Source

pub fn pwm_input<REMAP, PINS>( self, pins: PINS, mapr: &mut MAPR, dbg: &mut DBG, mode: Configuration, ) -> PwmInput<TIM4, REMAP, PINS>
where REMAP: Remap<Periph = TIM4>, PINS: Pins<REMAP>,

Source§

impl Timer<SYST>

Source

pub fn delay(self) -> SysDelay

Source§

impl Timer<SYST>

Source

pub fn counter_hz(self) -> SysCounterHz

Creates SysCounterHz which takes Hertz as Duration

Source

pub fn counter<const FREQ: u32>(self) -> SysCounter<FREQ>

Creates SysCounter with custom precision (core frequency recommended is known)

Source

pub fn counter_us(self) -> SysCounterUs

Creates SysCounter 1 microsecond precision

Source§

impl<TIM: Instance + WithPwm> Timer<TIM>

Source

pub fn pwm_hz<REMAP, P, PINS>( self, _pins: PINS, mapr: &mut MAPR, freq: Hertz, ) -> PwmHz<TIM, REMAP, P, PINS>
where REMAP: Remap<Periph = TIM>, PINS: Pins<REMAP, P>,

Source§

impl Timer<SYST>

Source

pub fn syst(tim: SYST, clocks: &Clocks) -> Self

Initialize SysTick timer

Source

pub fn syst_external(tim: SYST, clocks: &Clocks) -> Self

Initialize SysTick timer and set it frequency to HCLK / 8

Source

pub fn configure(&mut self, clocks: &Clocks)

Source

pub fn configure_external(&mut self, clocks: &Clocks)

Source

pub fn release(self) -> SYST

Source

pub fn listen(&mut self, event: SysEvent)

Starts listening for an event

Source

pub fn unlisten(&mut self, event: SysEvent)

Stops listening for an event

Source

pub fn reset(&mut self)

Resets the counter

Source§

impl<TIM: Instance> Timer<TIM>

Source

pub fn new(tim: TIM, clocks: &Clocks) -> Self

Initialize timer

Source

pub fn configure(&mut self, clocks: &Clocks)

Source

pub fn counter_hz(self) -> CounterHz<TIM>

Source

pub fn release(self) -> TIM

Source

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.

Source

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.

Source

pub fn get_interrupt(&mut self) -> Event

Source

pub fn unlisten(&mut self, event: Event)

Stops listening for an event

Source

pub fn stop_in_debug(&mut self, dbg: &mut DBG, state: bool)

Stopping timer in debug mode can cause troubles when sampling the signal

Source§

impl<TIM: Instance + MasterTimer> Timer<TIM>

Source

pub fn set_master_mode(&mut self, mode: TIM::Mms)

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.