Struct nrf52832_hal::Timer

source ·
pub struct Timer<T>(_);
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.

Implementations

Return the raw interface to the underlying timer peripheral

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.

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.

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.