[][src]Struct nrf52832_hal::Timer

pub struct Timer<T>(_);

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]

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> Cancel for Timer<T> where
    T: TimerExt
[src]

type Error = ()

Error returned when a countdown can't be canceled.

impl<T> CountDown for Timer<T> where
    T: TimerExt
[src]

type Time = u32

The unit of time used by this timer

fn start<Time>(&mut self, cycles: Time) where
    Time: Into<<Timer<T> as CountDown>::Time>, 
[src]

Start the timer

The timer will run for the given number of cycles, then it will stop and reset.

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.

Auto Trait Implementations

impl<T> Send for Timer<T> where
    T: Send

impl<T> Sync for Timer<T> where
    T: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self