Struct OneShotTimer

Source
pub struct OneShotTimer<'d, Dm: DriverMode> { /* private fields */ }
Available on crate feature unstable only.
Expand description

A one-shot timer.

Implementations§

Source§

impl<'d> OneShotTimer<'d, Blocking>

Source

pub fn new( inner: impl Peripheral<P = impl Timer> + 'd, ) -> OneShotTimer<'d, Blocking>

Construct a new instance of OneShotTimer.

Source§

impl<'d> OneShotTimer<'d, Blocking>

Source

pub fn into_async(self) -> OneShotTimer<'d, Async>

Converts the driver to Async mode.

Source§

impl OneShotTimer<'_, Async>

Source

pub fn into_blocking(self) -> Self

Converts the driver to Blocking mode.

Source

pub async fn delay_nanos_async(&mut self, ns: u32)

Delay for at least ns nanoseconds.

Source

pub async fn delay_millis_async(&mut self, ms: u32)

Delay for at least ms milliseconds.

Source

pub async fn delay_micros_async(&mut self, us: u32)

Delay for at least us microseconds.

Source§

impl<Dm> OneShotTimer<'_, Dm>
where Dm: DriverMode,

Source

pub fn delay_millis(&mut self, ms: u32)

Delay for at least ms milliseconds.

Source

pub fn delay_micros(&mut self, us: u32)

Delay for at least us microseconds.

Source

pub fn delay_nanos(&mut self, ns: u32)

Delay for at least ns nanoseconds.

Source

pub fn schedule(&mut self, timeout: Duration) -> Result<(), Error>

Start counting until the given timeout and raise an interrupt

Source

pub fn stop(&mut self)

Stop the timer

Source

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

Set the interrupt handler

Note that this will replace any previously set interrupt handler

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

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

Enable listening for interrupts

Source

pub fn clear_interrupt(&mut self)

Clear the interrupt flag

Trait Implementations§

Source§

impl DelayNs for OneShotTimer<'_, Async>

Source§

async fn delay_ns(&mut self, ns: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

async fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

async fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

impl DelayNs for OneShotTimer<'_, Blocking>

Source§

fn delay_ns(&mut self, ns: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

impl<Dm> InterruptConfigurable for OneShotTimer<'_, Dm>
where Dm: DriverMode,

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Registers an interrupt handler for the peripheral. Read more

Auto Trait Implementations§

§

impl<'d, Dm> Freeze for OneShotTimer<'d, Dm>

§

impl<'d, Dm> !RefUnwindSafe for OneShotTimer<'d, Dm>

§

impl<'d, Dm> Send for OneShotTimer<'d, Dm>
where Dm: Send,

§

impl<'d, Dm> !Sync for OneShotTimer<'d, Dm>

§

impl<'d, Dm> Unpin for OneShotTimer<'d, Dm>
where Dm: Unpin,

§

impl<'d, Dm> !UnwindSafe for OneShotTimer<'d, Dm>

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.