FTimer

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

Source

pub fn new(tim: TIM, clk: HertzU32) -> Self

Initialize timer

Source

pub fn configure(&mut self)

Calculate prescaler depending on Clocks state

Source

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

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, state: bool)

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

Source§

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

Source

pub fn set_master_mode(&mut self, mode: MasterMode)

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§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.