Struct Timer

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

Hardware timers

Implementations§

Source§

impl Timer<TIM2>

Source

pub fn tim2(tim: TIM2, timeout: Hertz, clocks: Clocks, apb: &mut APB1R1) -> Self

Configures a TIM peripheral as a periodic count down timer

Source

pub fn free_running_tim2( tim: TIM2, clocks: Clocks, frequency: Hertz, event_on_overflow: bool, apb: &mut APB1R1, ) -> Self

Start a free running, monotonic, timer running at some specific frequency.

May generate events on overflow of the timer.

Source

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

Starts listening for an event

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 unlisten(&mut self, event: Event)

Stops listening for an event

Source

pub fn clear_update_interrupt_flag(&mut self)

Clears Update Interrupt Flag

Source

pub fn count() -> u32

Get the count of the timer.

Source

pub fn free(self) -> TIM2

Releases the TIM peripheral

Source§

impl Timer<TIM6>

Source

pub fn tim6(tim: TIM6, timeout: Hertz, clocks: Clocks, apb: &mut APB1R1) -> Self

Configures a TIM peripheral as a periodic count down timer

Source

pub fn free_running_tim6( tim: TIM6, clocks: Clocks, frequency: Hertz, event_on_overflow: bool, apb: &mut APB1R1, ) -> Self

Start a free running, monotonic, timer running at some specific frequency.

May generate events on overflow of the timer.

Source

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

Starts listening for an event

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 unlisten(&mut self, event: Event)

Stops listening for an event

Source

pub fn clear_update_interrupt_flag(&mut self)

Clears Update Interrupt Flag

Source

pub fn count() -> u16

Get the count of the timer.

Source

pub fn free(self) -> TIM6

Releases the TIM peripheral

Source§

impl Timer<TIM15>

Source

pub fn tim15(tim: TIM15, timeout: Hertz, clocks: Clocks, apb: &mut APB2) -> Self

Configures a TIM peripheral as a periodic count down timer

Source

pub fn free_running_tim15( tim: TIM15, clocks: Clocks, frequency: Hertz, event_on_overflow: bool, apb: &mut APB2, ) -> Self

Start a free running, monotonic, timer running at some specific frequency.

May generate events on overflow of the timer.

Source

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

Starts listening for an event

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 unlisten(&mut self, event: Event)

Stops listening for an event

Source

pub fn clear_update_interrupt_flag(&mut self)

Clears Update Interrupt Flag

Source

pub fn count() -> u16

Get the count of the timer.

Source

pub fn free(self) -> TIM15

Releases the TIM peripheral

Source§

impl Timer<TIM16>

Source

pub fn tim16(tim: TIM16, timeout: Hertz, clocks: Clocks, apb: &mut APB2) -> Self

Configures a TIM peripheral as a periodic count down timer

Source

pub fn free_running_tim16( tim: TIM16, clocks: Clocks, frequency: Hertz, event_on_overflow: bool, apb: &mut APB2, ) -> Self

Start a free running, monotonic, timer running at some specific frequency.

May generate events on overflow of the timer.

Source

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

Starts listening for an event

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 unlisten(&mut self, event: Event)

Stops listening for an event

Source

pub fn clear_update_interrupt_flag(&mut self)

Clears Update Interrupt Flag

Source

pub fn count() -> u16

Get the count of the timer.

Source

pub fn free(self) -> TIM16

Releases the TIM peripheral

Source§

impl Timer<TIM7>

Source

pub fn tim7(tim: TIM7, timeout: Hertz, clocks: Clocks, apb: &mut APB1R1) -> Self

Configures a TIM peripheral as a periodic count down timer

Source

pub fn free_running_tim7( tim: TIM7, clocks: Clocks, frequency: Hertz, event_on_overflow: bool, apb: &mut APB1R1, ) -> Self

Start a free running, monotonic, timer running at some specific frequency.

May generate events on overflow of the timer.

Source

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

Starts listening for an event

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 unlisten(&mut self, event: Event)

Stops listening for an event

Source

pub fn clear_update_interrupt_flag(&mut self)

Clears Update Interrupt Flag

Source

pub fn count() -> u16

Get the count of the timer.

Source

pub fn free(self) -> TIM7

Releases the TIM peripheral

Trait Implementations§

Source§

impl CountDown for Timer<TIM15>

Source§

type Time = Rate<u32, 1, 1>

The unit of time used by this timer
Source§

fn start<T>(&mut self, timeout: T)
where T: Into<Hertz>,

Starts a new count down
Source§

fn wait(&mut self) -> Result<(), Void>

Non-blockingly “waits” until the count down finishes Read more
Source§

impl CountDown for Timer<TIM16>

Source§

type Time = Rate<u32, 1, 1>

The unit of time used by this timer
Source§

fn start<T>(&mut self, timeout: T)
where T: Into<Hertz>,

Starts a new count down
Source§

fn wait(&mut self) -> Result<(), Void>

Non-blockingly “waits” until the count down finishes Read more
Source§

impl CountDown for Timer<TIM2>

Source§

type Time = Rate<u32, 1, 1>

The unit of time used by this timer
Source§

fn start<T>(&mut self, timeout: T)
where T: Into<Hertz>,

Starts a new count down
Source§

fn wait(&mut self) -> Result<(), Void>

Non-blockingly “waits” until the count down finishes Read more
Source§

impl CountDown for Timer<TIM6>

Source§

type Time = Rate<u32, 1, 1>

The unit of time used by this timer
Source§

fn start<T>(&mut self, timeout: T)
where T: Into<Hertz>,

Starts a new count down
Source§

fn wait(&mut self) -> Result<(), Void>

Non-blockingly “waits” until the count down finishes Read more
Source§

impl CountDown for Timer<TIM7>

Source§

type Time = Rate<u32, 1, 1>

The unit of time used by this timer
Source§

fn start<T>(&mut self, timeout: T)
where T: Into<Hertz>,

Starts a new count down
Source§

fn wait(&mut self) -> Result<(), Void>

Non-blockingly “waits” until the count down finishes Read more
Source§

impl Periodic for Timer<TIM15>

Source§

impl Periodic for Timer<TIM16>

Source§

impl Periodic for Timer<TIM2>

Source§

impl Periodic for Timer<TIM6>

Source§

impl Periodic for Timer<TIM7>

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.