esp_hal::timer

Struct PeriodicTimer

Source
pub struct PeriodicTimer<'d, T> { /* private fields */ }
Expand description

A periodic timer.

Implementations§

Source§

impl<'d, T> PeriodicTimer<'d, T>
where T: Timer,

Source

pub fn new(inner: impl Peripheral<P = T> + 'd) -> Self

Construct a new instance of PeriodicTimer.

Source

pub fn start(&mut self, timeout: MicrosDurationU64) -> Result<(), Error>

Start a new count down.

Source

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

“Wait” until the count down finishes without blocking.

Source

pub fn cancel(&mut self) -> Result<(), Error>

Tries to cancel the active count down.

Source

pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Set the interrupt handler

Note that this will replace any previously set interrupt handler

Source

pub fn enable_interrupt(&mut self, enable: bool)

Enable/disable listening for interrupts

Source

pub fn clear_interrupt(&mut self)

Clear the interrupt flag

Trait Implementations§

Source§

impl<T> Cancel for PeriodicTimer<'_, T>
where T: Timer,

Source§

type Error = Error

Error returned when a countdown can’t be canceled.
Source§

fn cancel(&mut self) -> Result<(), Self::Error>

Tries to cancel this countdown. Read more
Source§

impl<T> InterruptConfigurable for PeriodicTimer<'_, T>
where T: Timer,

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Set the interrupt handler Read more
Source§

impl<T> CountDown for PeriodicTimer<'_, T>
where T: Timer,

Source§

type Time = Duration<u64, 1, 1000000>

The unit of time used by this timer
Source§

fn start<Time>(&mut self, timeout: Time)
where Time: Into<Self::Time>,

Starts a new count down
Source§

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

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

impl<T> Periodic for PeriodicTimer<'_, T>
where T: Timer,

Auto Trait Implementations§

§

impl<'d, T> Freeze for PeriodicTimer<'d, T>
where T: Freeze,

§

impl<'d, T> RefUnwindSafe for PeriodicTimer<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for PeriodicTimer<'d, T>
where T: Send,

§

impl<'d, T> Sync for PeriodicTimer<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for PeriodicTimer<'d, T>
where T: Unpin,

§

impl<'d, T> !UnwindSafe for PeriodicTimer<'d, T>

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.