[−][src]Struct nrf52_hal_common::timer::Timer
Interface to a TIMER instance
Right now, this is a very basic interface. The timer will always be hardcoded to a frequency of 1 MHz and 32 bits accuracy.
Methods
impl<T> Timer<T> where
T: TimerExt,
[src]
T: TimerExt,
pub fn free(self) -> T
[src]
Return the raw interface to the underlying timer peripheral
pub fn enable_interrupt(&mut self, nvic: &mut NVIC)
[src]
Enables the interrupt for this timer
Enables an interrupt that is fired when the timer reaches the value that
is given as an argument to start
.
pub fn disable_interrupt(&mut self, nvic: &mut NVIC)
[src]
Disables the interrupt for this timer
Disables an interrupt that is fired when the timer reaches the value
that is given as an argument to start
.
pub fn delay(&mut self, cycles: u32)
[src]
Trait Implementations
impl<T> CountDown for Timer<T> where
T: TimerExt,
[src]
T: TimerExt,
type Time = u32
The unit of time used by this timer
fn start<Time>(&mut self, cycles: Time) where
Time: Into<Self::Time>,
[src]
Time: Into<Self::Time>,
Start the timer
The timer will run for the given number of cycles, then it will stop and reset.
fn wait(&mut self) -> Result<(), Void>
[src]
Wait for the timer to stop
Will return Err(nb::Error::WouldBlock)
while the timer is still
running. Once the timer reached the number of cycles given in the
start
method, it will return Ok(())
.
To block until the timer has stopped, use the block!
macro from the
nb
crate. Please refer to the documentation of nb
for other options.
impl<T> Cancel for Timer<T> where
T: TimerExt,
[src]
T: TimerExt,
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
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>
[src]
impl<T> From for T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
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>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same for T
type Output = T
Should always be Self