Struct MonoTimer

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

Implementations§

Source§

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

Source

pub fn release(self) -> FTimer<TIM, FREQ>

Releases the TIM peripheral

Methods from Deref<Target = FTimer<TIM, FREQ>>§

Source

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

Calculate prescaler depending on Clocks state

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

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

Trait Implementations§

Source§

impl<TIM, const FREQ: u32> Deref for MonoTimer<TIM, FREQ>

Source§

type Target = FTimer<TIM, FREQ>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<TIM, const FREQ: u32> DerefMut for MonoTimer<TIM, FREQ>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<const FREQ: u32> Monotonic for MonoTimer<TIM1, FREQ>

Source§

type Instant = Instant<u32, 1, FREQ>

The type for instant, defining an instant in time. Read more
Source§

type Duration = Duration<u32, 1, FREQ>

The type for duration, defining an duration of time. Read more
Source§

unsafe fn reset(&mut self)

Optionally resets the counter to zero for a fixed baseline in a system. Read more
Source§

fn now(&mut self) -> Self::Instant

Get the current time.
Source§

fn set_compare(&mut self, instant: Self::Instant)

Set the compare value of the timer interrupt. Read more
Source§

fn clear_compare_flag(&mut self)

Clear the compare interrupt flag.
Source§

fn on_interrupt(&mut self)

Optional. Commonly used for performing housekeeping of a timer when it has been extended, e.g. a 16 bit timer extended to 32/64 bits. This will be called at the end of the interrupt handler after all other operations have finished.
Source§

fn zero() -> Self::Instant

The time at time zero. Used by RTIC before the monotonic has been initialized.
Source§

const DISABLE_INTERRUPT_ON_EMPTY_QUEUE: bool = true

This tells RTIC if it should disable the interrupt bound to the monotonic if there are no scheduled tasks. One may want to set this to false if one is using the on_interrupt method to perform housekeeping and need overflow interrupts to happen, such as when extending a 16 bit timer to 32/64 bits, even if there are no scheduled tasks.
Source§

fn enable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is enabled.
Source§

fn disable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is disabled.
Source§

impl<const FREQ: u32> Monotonic for MonoTimer<TIM2, FREQ>

Source§

type Instant = Instant<u32, 1, FREQ>

The type for instant, defining an instant in time. Read more
Source§

type Duration = Duration<u32, 1, FREQ>

The type for duration, defining an duration of time. Read more
Source§

unsafe fn reset(&mut self)

Optionally resets the counter to zero for a fixed baseline in a system. Read more
Source§

fn now(&mut self) -> Self::Instant

Get the current time.
Source§

fn set_compare(&mut self, instant: Self::Instant)

Set the compare value of the timer interrupt. Read more
Source§

fn clear_compare_flag(&mut self)

Clear the compare interrupt flag.
Source§

fn on_interrupt(&mut self)

Optional. Commonly used for performing housekeeping of a timer when it has been extended, e.g. a 16 bit timer extended to 32/64 bits. This will be called at the end of the interrupt handler after all other operations have finished.
Source§

fn zero() -> Self::Instant

The time at time zero. Used by RTIC before the monotonic has been initialized.
Source§

const DISABLE_INTERRUPT_ON_EMPTY_QUEUE: bool = true

This tells RTIC if it should disable the interrupt bound to the monotonic if there are no scheduled tasks. One may want to set this to false if one is using the on_interrupt method to perform housekeeping and need overflow interrupts to happen, such as when extending a 16 bit timer to 32/64 bits, even if there are no scheduled tasks.
Source§

fn enable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is enabled.
Source§

fn disable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is disabled.
Source§

impl<const FREQ: u32> Monotonic for MonoTimer<TIM3, FREQ>

Source§

type Instant = Instant<u32, 1, FREQ>

The type for instant, defining an instant in time. Read more
Source§

type Duration = Duration<u32, 1, FREQ>

The type for duration, defining an duration of time. Read more
Source§

unsafe fn reset(&mut self)

Optionally resets the counter to zero for a fixed baseline in a system. Read more
Source§

fn now(&mut self) -> Self::Instant

Get the current time.
Source§

fn set_compare(&mut self, instant: Self::Instant)

Set the compare value of the timer interrupt. Read more
Source§

fn clear_compare_flag(&mut self)

Clear the compare interrupt flag.
Source§

fn on_interrupt(&mut self)

Optional. Commonly used for performing housekeeping of a timer when it has been extended, e.g. a 16 bit timer extended to 32/64 bits. This will be called at the end of the interrupt handler after all other operations have finished.
Source§

fn zero() -> Self::Instant

The time at time zero. Used by RTIC before the monotonic has been initialized.
Source§

const DISABLE_INTERRUPT_ON_EMPTY_QUEUE: bool = true

This tells RTIC if it should disable the interrupt bound to the monotonic if there are no scheduled tasks. One may want to set this to false if one is using the on_interrupt method to perform housekeeping and need overflow interrupts to happen, such as when extending a 16 bit timer to 32/64 bits, even if there are no scheduled tasks.
Source§

fn enable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is enabled.
Source§

fn disable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is disabled.
Source§

impl<const FREQ: u32> Monotonic for MonoTimer<TIM4, FREQ>

Source§

type Instant = Instant<u32, 1, FREQ>

The type for instant, defining an instant in time. Read more
Source§

type Duration = Duration<u32, 1, FREQ>

The type for duration, defining an duration of time. Read more
Source§

unsafe fn reset(&mut self)

Optionally resets the counter to zero for a fixed baseline in a system. Read more
Source§

fn now(&mut self) -> Self::Instant

Get the current time.
Source§

fn set_compare(&mut self, instant: Self::Instant)

Set the compare value of the timer interrupt. Read more
Source§

fn clear_compare_flag(&mut self)

Clear the compare interrupt flag.
Source§

fn on_interrupt(&mut self)

Optional. Commonly used for performing housekeeping of a timer when it has been extended, e.g. a 16 bit timer extended to 32/64 bits. This will be called at the end of the interrupt handler after all other operations have finished.
Source§

fn zero() -> Self::Instant

The time at time zero. Used by RTIC before the monotonic has been initialized.
Source§

const DISABLE_INTERRUPT_ON_EMPTY_QUEUE: bool = true

This tells RTIC if it should disable the interrupt bound to the monotonic if there are no scheduled tasks. One may want to set this to false if one is using the on_interrupt method to perform housekeeping and need overflow interrupts to happen, such as when extending a 16 bit timer to 32/64 bits, even if there are no scheduled tasks.
Source§

fn enable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is enabled.
Source§

fn disable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is disabled.
Source§

impl<const FREQ: u32> Monotonic for MonoTimer<TIM5, FREQ>

Source§

type Instant = Instant<u32, 1, FREQ>

The type for instant, defining an instant in time. Read more
Source§

type Duration = Duration<u32, 1, FREQ>

The type for duration, defining an duration of time. Read more
Source§

unsafe fn reset(&mut self)

Optionally resets the counter to zero for a fixed baseline in a system. Read more
Source§

fn now(&mut self) -> Self::Instant

Get the current time.
Source§

fn set_compare(&mut self, instant: Self::Instant)

Set the compare value of the timer interrupt. Read more
Source§

fn clear_compare_flag(&mut self)

Clear the compare interrupt flag.
Source§

fn on_interrupt(&mut self)

Optional. Commonly used for performing housekeeping of a timer when it has been extended, e.g. a 16 bit timer extended to 32/64 bits. This will be called at the end of the interrupt handler after all other operations have finished.
Source§

fn zero() -> Self::Instant

The time at time zero. Used by RTIC before the monotonic has been initialized.
Source§

const DISABLE_INTERRUPT_ON_EMPTY_QUEUE: bool = true

This tells RTIC if it should disable the interrupt bound to the monotonic if there are no scheduled tasks. One may want to set this to false if one is using the on_interrupt method to perform housekeeping and need overflow interrupts to happen, such as when extending a 16 bit timer to 32/64 bits, even if there are no scheduled tasks.
Source§

fn enable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is enabled.
Source§

fn disable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is disabled.
Source§

impl<const FREQ: u32> Monotonic for MonoTimer<TIM8, FREQ>

Source§

type Instant = Instant<u32, 1, FREQ>

The type for instant, defining an instant in time. Read more
Source§

type Duration = Duration<u32, 1, FREQ>

The type for duration, defining an duration of time. Read more
Source§

unsafe fn reset(&mut self)

Optionally resets the counter to zero for a fixed baseline in a system. Read more
Source§

fn now(&mut self) -> Self::Instant

Get the current time.
Source§

fn set_compare(&mut self, instant: Self::Instant)

Set the compare value of the timer interrupt. Read more
Source§

fn clear_compare_flag(&mut self)

Clear the compare interrupt flag.
Source§

fn on_interrupt(&mut self)

Optional. Commonly used for performing housekeeping of a timer when it has been extended, e.g. a 16 bit timer extended to 32/64 bits. This will be called at the end of the interrupt handler after all other operations have finished.
Source§

fn zero() -> Self::Instant

The time at time zero. Used by RTIC before the monotonic has been initialized.
Source§

const DISABLE_INTERRUPT_ON_EMPTY_QUEUE: bool = true

This tells RTIC if it should disable the interrupt bound to the monotonic if there are no scheduled tasks. One may want to set this to false if one is using the on_interrupt method to perform housekeeping and need overflow interrupts to happen, such as when extending a 16 bit timer to 32/64 bits, even if there are no scheduled tasks.
Source§

fn enable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is enabled.
Source§

fn disable_timer(&mut self)

Optional. This is used to save power, this is called when the Monotonic interrupt is disabled.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<TIM, const FREQ: u32> UnwindSafe for MonoTimer<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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.