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

Return the raw interface to the underlying timer peripheral.

Return the current value of the counter, by capturing to CC[1].

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

Error returned when a countdown can’t be canceled.

Tries to cancel this countdown. Read more

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.

The unit of time used by this timer

Pauses execution for ms milliseconds

Pauses execution for ms milliseconds

Pauses execution for ms milliseconds

Pauses execution for us microseconds

Pauses execution for us microseconds

Pauses execution for us microseconds

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Casts the value.

OverflowingCasts the value.

Should always be Self

Casts the value.

Casts the value.

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.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.