Module timer

Source
Expand description

Monotonic implementation for the 32-bit timers of the nRF series.

Not all timers are available on all parts. Ensure that only the available timers are exposed by having the correct nrf52* feature enabled for rtic-monotonics.

§Example

use rtic_monotonics::nrf::timer::prelude::*;

// Create the type `Mono`. It will manage the TIMER0 timer, and
// run with a resolution of 1 µs (1,000,000 ticks per second).
nrf_timer0_monotonic!(Mono, 1_000_000);

fn init() {
    // Start the monotonic, passing ownership of a TIMER0 object from the
    // relevant nRF52x PAC.
    Mono::start(TIMER0);
}

async fn usage() {
    loop {
         // You can use the monotonic to get the time...
         let timestamp = Mono::now();
         // ...and you can use it to add a delay to this async function
         Mono::delay(100.millis()).await;
    }
}

Modules§

prelude
Common definitions and traits for using the nRF Timer monotonics

Structs§

Timer0Backend
Timer peripheral based TimerQueueBackend.
Timer1Backend
Timer peripheral based TimerQueueBackend.
Timer2Backend
Timer peripheral based TimerQueueBackend.
Timer3Backend
Timer peripheral based TimerQueueBackend.
Timer4Backend
Timer peripheral based TimerQueueBackend.