Struct nrf52832_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
impl<T, U> Timer<T, U> where
T: Instance,
[src]
impl<T, U> Timer<T, U> where
T: Instance,
[src]pub const TICKS_PER_SECOND: u32
[src]
pub fn into_periodic(self) -> Timer<T, Periodic>
[src]
pub fn into_oneshot(self) -> Timer<T, OneShot>
[src]
pub fn enable_interrupt(&mut self)
[src]
pub fn enable_interrupt(&mut self)
[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
.
Note that the interrupt also has to be unmasked in the NVIC, or the handler won’t get called.
pub fn disable_interrupt(&mut self)
[src]
pub fn disable_interrupt(&mut self)
[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
.
Note that the interrupt also has to be unmasked in the NVIC, or the handler won’t get called.
pub fn delay(&mut self, cycles: u32)
[src]
pub fn task_start(&self) -> &Reg<u32, _TASKS_START>
[src]
pub fn task_start(&self) -> &Reg<u32, _TASKS_START>
[src]Returns reference to the START
task endpoint for PPI.
Starts timer.
pub fn task_stop(&self) -> &Reg<u32, _TASKS_STOP>
[src]
pub fn task_stop(&self) -> &Reg<u32, _TASKS_STOP>
[src]Returns reference to the STOP
task endpoint for PPI.
Stops timer.
pub fn task_count(&self) -> &Reg<u32, _TASKS_COUNT>
[src]
pub fn task_count(&self) -> &Reg<u32, _TASKS_COUNT>
[src]Returns reference to the COUNT
task endpoint for PPI.
Increments timer (counter mode only).
pub fn task_clear(&self) -> &Reg<u32, _TASKS_CLEAR>
[src]
pub fn task_clear(&self) -> &Reg<u32, _TASKS_CLEAR>
[src]Returns reference to the CLEAR
task endpoint for PPI.
Clears timer.
pub fn task_capture_cc0(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]
pub fn task_capture_cc0(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]Returns reference to the CC[0] CAPTURE
task endpoint for PPI.
Captures timer value to the CC[0] register.
pub fn task_capture_cc1(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]
pub fn task_capture_cc1(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]Returns reference to the CC[1] CAPTURE
task endpoint for PPI.
Captures timer value to the CC[1] register.
pub fn task_capture_cc2(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]
pub fn task_capture_cc2(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]Returns reference to the CC[2] CAPTURE
task endpoint for PPI.
Captures timer value to the CC[2] register.
pub fn task_capture_cc3(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]
pub fn task_capture_cc3(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]Returns reference to the CC[3] CAPTURE
task endpoint for PPI.
Captures timer value to the CC[3] register.
pub fn event_compare_cc0(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]
pub fn event_compare_cc0(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]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.
pub fn event_compare_cc1(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]
pub fn event_compare_cc1(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]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.
pub fn event_compare_cc2(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]
pub fn event_compare_cc2(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]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.
pub fn event_compare_cc3(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]
pub fn event_compare_cc3(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]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
impl<T, U> CountDown for Timer<T, U> where
T: Instance,
[src]
impl<T, U> CountDown for Timer<T, U> where
T: Instance,
[src]pub fn start<Time>(&mut self, cycles: Time) where
Time: Into<<Timer<T, U> as CountDown>::Time>,
[src]
pub fn start<Time>(&mut self, cycles: Time) where
Time: Into<<Timer<T, U> as CountDown>::Time>,
[src]Start the timer.
The timer will run for the given number of cycles, then it will stop and reset.
pub fn wait(&mut self) -> Result<(), Error<Void>>
[src]
pub fn wait(&mut self) -> Result<(), Error<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.
type Time = u32
type Time = u32
The unit of time used by this timer
impl ExtendedCCTimer for Timer<TIMER4, OneShot>
[src]
impl ExtendedCCTimer for Timer<TIMER4, OneShot>
[src]pub fn task_capture_cc4(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]
pub fn task_capture_cc4(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]Returns reference to the CC[4] CAPTURE
task endpoint for PPI.
pub fn task_capture_cc5(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]
pub fn task_capture_cc5(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]Returns reference to the CC[5] CAPTURE
task endpoint for PPI.
pub fn event_compare_cc4(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]
pub fn event_compare_cc4(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]Returns reference to the CC[4] COMPARE
event endpoint for PPI.
pub fn event_compare_cc5(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]
pub fn event_compare_cc5(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]Returns reference to the CC[5] COMPARE
event endpoint for PPI.
impl ExtendedCCTimer for Timer<TIMER3, OneShot>
[src]
impl ExtendedCCTimer for Timer<TIMER3, OneShot>
[src]pub fn task_capture_cc4(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]
pub fn task_capture_cc4(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]Returns reference to the CC[4] CAPTURE
task endpoint for PPI.
pub fn task_capture_cc5(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]
pub fn task_capture_cc5(&self) -> &Reg<u32, _TASKS_CAPTURE>
[src]Returns reference to the CC[5] CAPTURE
task endpoint for PPI.
pub fn event_compare_cc4(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]
pub fn event_compare_cc4(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]Returns reference to the CC[4] COMPARE
event endpoint for PPI.
pub fn event_compare_cc5(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]
pub fn event_compare_cc5(&self) -> &Reg<u32, _EVENTS_COMPARE>
[src]Returns reference to the CC[5] COMPARE
event endpoint for PPI.
impl<T> Periodic for Timer<T, Periodic> where
T: Instance,
[src]
T: Instance,
Auto Trait Implementations
impl<T, U> Send for Timer<T, U> where
T: Send,
U: Send,
T: Send,
U: Send,
impl<T, U> Sync for Timer<T, U> where
T: Sync,
U: Sync,
T: Sync,
U: Sync,
impl<T, U> Unpin for Timer<T, U> where
T: Unpin,
U: Unpin,
T: Unpin,
U: Unpin,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> CheckedAs for T
[src]
impl<T> CheckedAs for T
[src]pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]Casts the value.
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
[src]
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
[src]pub fn lossless_try_into(self) -> Option<Dst>
[src]
pub fn lossless_try_into(self) -> Option<Dst>
[src]Performs the conversion.
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
[src]
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
[src]pub fn lossy_into(self) -> Dst
[src]
pub fn lossy_into(self) -> Dst
[src]Performs the conversion.
impl<T> OverflowingAs for T
[src]
impl<T> OverflowingAs for T
[src]pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]Casts the value.
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> SaturatingAs for T
[src]
impl<T> SaturatingAs for T
[src]pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]Casts the value.
impl<T> UnwrappedAs for T
[src]
impl<T> UnwrappedAs for T
[src]pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
[src]
pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
[src]Casts the value.
impl<T> WrappingAs for T
[src]
impl<T> WrappingAs for T
[src]pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]Casts the value.