Struct nrf52833_hal::Timer [−][src]
pub struct Timer<T, U = OneShot>(_, _);
Expand description
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.
CC[0] is used for the current/most-recent delay period and CC[1] is used to grab the current value of the counter at a given instant.
Implementations
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
.
Note that the interrupt also has to be unmasked in the NVIC, or the handler won’t get called.
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
.
Note that the interrupt also has to be unmasked in the NVIC, or the handler won’t get called.
Returns reference to the START
task endpoint for PPI.
Starts timer.
Returns reference to the STOP
task endpoint for PPI.
Stops timer.
Returns reference to the COUNT
task endpoint for PPI.
Increments timer (counter mode only).
Returns reference to the CLEAR
task endpoint for PPI.
Clears timer.
Returns reference to the CC[0] CAPTURE
task endpoint for PPI.
Captures timer value to the CC[0] register.
Returns reference to the CC[1] CAPTURE
task endpoint for PPI.
Captures timer value to the CC[1] register.
Returns reference to the CC[2] CAPTURE
task endpoint for PPI.
Captures timer value to the CC[2] register.
Returns reference to the CC[3] CAPTURE
task endpoint for PPI.
Captures timer value to the CC[3] register.
Returns reference to the CC[0] COMPARE
event endpoint for PPI.
Generated when the counter is incremented and then matches the value
specified in the CC[0] register.
Returns reference to the CC[1] COMPARE
event endpoint for PPI.
Generated when the counter is incremented and then matches the value
specified in the CC[1] register.
Returns reference to the CC[2] COMPARE
event endpoint for PPI.
Generated when the counter is incremented and then matches the value
specified in the CC[2] register.
Returns reference to the CC[3] COMPARE
event endpoint for PPI.
Generated when the counter is incremented and then matches the value
specified in the CC[3] register.
Trait Implementations
Start the timer.
The timer will run for the given number of cycles, then it will stop and reset.
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.
Returns reference to the CC[4] CAPTURE
task endpoint for PPI.
Returns reference to the CC[5] CAPTURE
task endpoint for PPI.
Returns reference to the CC[4] COMPARE
event endpoint for PPI.
Returns reference to the CC[5] COMPARE
event endpoint for PPI.
Returns reference to the CC[4] CAPTURE
task endpoint for PPI.
Returns reference to the CC[5] CAPTURE
task endpoint for PPI.
Returns reference to the CC[4] COMPARE
event endpoint for PPI.
Returns reference to the CC[5] COMPARE
event endpoint for PPI.
Auto Trait Implementations
impl<T, U> RefUnwindSafe for Timer<T, U> where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> UnwindSafe for Timer<T, U> where
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Performs the conversion.
Performs the conversion.
Casts the value.
Casts the value.
Casts the value.
Casts the value.