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>
impl<'d> OneShotTimer<'d, Blocking>
Sourcepub fn new(
inner: impl Peripheral<P = impl Timer> + 'd,
) -> OneShotTimer<'d, Blocking>
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>
impl<'d> OneShotTimer<'d, Blocking>
Sourcepub fn into_async(self) -> OneShotTimer<'d, Async>
pub fn into_async(self) -> OneShotTimer<'d, Async>
Converts the driver to Async
mode.
Source§impl OneShotTimer<'_, Async>
impl OneShotTimer<'_, Async>
Sourcepub fn into_blocking(self) -> Self
pub fn into_blocking(self) -> Self
Converts the driver to Blocking
mode.
Sourcepub async fn delay_nanos_async(&mut self, ns: u32)
pub async fn delay_nanos_async(&mut self, ns: u32)
Delay for at least ns
nanoseconds.
Sourcepub async fn delay_millis_async(&mut self, ms: u32)
pub async fn delay_millis_async(&mut self, ms: u32)
Delay for at least ms
milliseconds.
Sourcepub async fn delay_micros_async(&mut self, us: u32)
pub async fn delay_micros_async(&mut self, us: u32)
Delay for at least us
microseconds.
Source§impl<Dm> OneShotTimer<'_, Dm>where
Dm: DriverMode,
impl<Dm> OneShotTimer<'_, Dm>where
Dm: DriverMode,
Sourcepub fn delay_millis(&mut self, ms: u32)
pub fn delay_millis(&mut self, ms: u32)
Delay for at least ms
milliseconds.
Sourcepub fn delay_micros(&mut self, us: u32)
pub fn delay_micros(&mut self, us: u32)
Delay for at least us
microseconds.
Sourcepub fn delay_nanos(&mut self, ns: u32)
pub fn delay_nanos(&mut self, ns: u32)
Delay for at least ns
nanoseconds.
Sourcepub fn schedule(&mut self, timeout: Duration) -> Result<(), Error>
pub fn schedule(&mut self, timeout: Duration) -> Result<(), Error>
Start counting until the given timeout and raise an interrupt
Sourcepub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
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.
Sourcepub fn enable_interrupt(&mut self, enable: bool)
pub fn enable_interrupt(&mut self, enable: bool)
Enable listening for interrupts
Sourcepub fn clear_interrupt(&mut self)
pub fn clear_interrupt(&mut self)
Clear the interrupt flag
Trait Implementations§
Source§impl DelayNs for OneShotTimer<'_, Async>
impl DelayNs for OneShotTimer<'_, Async>
Source§async fn delay_ns(&mut self, ns: u32)
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§impl DelayNs for OneShotTimer<'_, Blocking>
impl DelayNs for OneShotTimer<'_, Blocking>
Source§fn delay_ns(&mut self, ns: u32)
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§impl<Dm> InterruptConfigurable for OneShotTimer<'_, Dm>where
Dm: DriverMode,
impl<Dm> InterruptConfigurable for OneShotTimer<'_, Dm>where
Dm: DriverMode,
Source§fn set_interrupt_handler(&mut self, handler: InterruptHandler)
fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Registers an interrupt handler for the peripheral. Read more