esp_hal::timer

Struct AnyTimer

Source
pub struct AnyTimer(/* private fields */);
Expand description

A type-erased timer

You can create an instance of this by just calling .into() on a timer.

Trait Implementations§

Source§

impl From<Alarm<'static, Periodic, Blocking>> for AnyTimer

Source§

fn from(value: Alarm<'static, Periodic, Blocking>) -> Self

Converts to this type from the input type.
Source§

impl From<Alarm<'static, Target, Blocking>> for AnyTimer

Source§

fn from(value: Alarm<'static, Target, Blocking>) -> Self

Converts to this type from the input type.
Source§

impl From<Timer<TimerX<TIMG0>, Blocking>> for AnyTimer

Source§

fn from(value: Timer<Timer0<TIMG0>, Blocking>) -> Self

Converts to this type from the input type.
Source§

impl From<Timer<TimerX<TIMG1>, Blocking>> for AnyTimer

Source§

fn from(value: Timer<Timer0<TIMG1>, Blocking>) -> Self

Converts to this type from the input type.
Source§

impl Peripheral for AnyTimer

Source§

type P = AnyTimer

Peripheral singleton type
Source§

unsafe fn clone_unchecked(&self) -> Self::P

Unsafely clone (duplicate) a peripheral singleton. Read more
Source§

fn into_ref<'a>(self) -> PeripheralRef<'a, Self::P>
where Self: 'a,

Convert a value into a PeripheralRef. Read more
Source§

fn map_into<U>(self) -> U
where Self::P: Into<U>, U: Peripheral<P = U>,

Map the peripheral using Into. Read more
Source§

impl Timer for AnyTimer

Source§

fn start(&self)

Start the timer.
Source§

fn stop(&self)

Stop the timer.
Source§

fn reset(&self)

Reset the timer value to 0.
Source§

fn is_running(&self) -> bool

Is the timer running?
Source§

fn now(&self) -> Instant<u64, 1, 1_000_000>

The current timer value.
Source§

fn load_value(&self, value: MicrosDurationU64) -> Result<(), Error>

Load a target value into the timer.
Source§

fn enable_auto_reload(&self, auto_reload: bool)

Enable auto reload of the loaded value.
Source§

fn enable_interrupt(&self, state: bool)

Enable or disable the timer’s interrupt.
Source§

fn clear_interrupt(&self)

Clear the timer’s interrupt.
Source§

fn set_interrupt_handler(&self, handler: InterruptHandler)

Set the interrupt handler Read more
Source§

fn is_interrupt_set(&self) -> bool

Has the timer triggered?

Auto Trait Implementations§

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.