Struct FTimer

Source
pub struct FTimer<TIM, const FREQ: u32> { /* private fields */ }
Expand description

Timer wrapper for fixed precision timers.

Uses fugit::TimerDurationU32 for most of operations

Implementations§

Source§

impl<const FREQ: u32> FTimer<TIM2, FREQ>

Source

pub fn monotonic(self) -> MonoTimer<TIM2, FREQ>

Source§

impl<const FREQ: u32> FTimer<TIM3, FREQ>

Source

pub fn monotonic(self) -> MonoTimer<TIM3, FREQ>

Source§

impl<const FREQ: u32> FTimer<TIM1, FREQ>

Source

pub fn monotonic(self) -> MonoTimer<TIM1, FREQ>

Source§

impl<const FREQ: u32> FTimer<TIM4, FREQ>

Source

pub fn monotonic(self) -> MonoTimer<TIM4, FREQ>

Source§

impl<const FREQ: u32> FTimer<TIM5, FREQ>

Source

pub fn monotonic(self) -> MonoTimer<TIM5, FREQ>

Source§

impl<const FREQ: u32> FTimer<TIM8, FREQ>

Source

pub fn monotonic(self) -> MonoTimer<TIM8, FREQ>

Source§

impl<TIM: Instance + WithPwm, const FREQ: u32> FTimer<TIM, FREQ>

Source

pub fn pwm<REMAP, P, PINS>( self, _pins: PINS, mapr: &mut MAPR, time: TimerDurationU32<FREQ>, ) -> Pwm<TIM, REMAP, P, PINS, FREQ>
where REMAP: Remap<Periph = TIM>, PINS: Pins<REMAP, P>,

Source§

impl<TIM: Instance, const FREQ: u32> FTimer<TIM, FREQ>

Source

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

Initialize timer

Source

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

Calculate prescaler depending on Clocks state

Source

pub fn counter(self) -> Counter<TIM, FREQ>

Creates Counter that imlements embedded_hal::timer::CountDown

Source

pub fn delay(self) -> Delay<TIM, FREQ>

Creates Delay that imlements embedded_hal::blocking::delay traits

Source

pub fn release(self) -> TIM

Releases the TIM peripheral

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, const FREQ: u32> FTimer<TIM, FREQ>

Source

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

Auto Trait Implementations§

§

impl<TIM, const FREQ: u32> Freeze for FTimer<TIM, FREQ>
where TIM: Freeze,

§

impl<TIM, const FREQ: u32> RefUnwindSafe for FTimer<TIM, FREQ>
where TIM: RefUnwindSafe,

§

impl<TIM, const FREQ: u32> Send for FTimer<TIM, FREQ>
where TIM: Send,

§

impl<TIM, const FREQ: u32> Sync for FTimer<TIM, FREQ>
where TIM: Sync,

§

impl<TIM, const FREQ: u32> Unpin for FTimer<TIM, FREQ>
where TIM: Unpin,

§

impl<TIM, const FREQ: u32> UnwindSafe for FTimer<TIM, FREQ>
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.