Crate groundhog_nrf52[][src]

Expand description

Contains a nrf52-compatible implementation of the RollingTimer trait.

The GlobalRollingTimer is especially helpful if you are running RTIC on a nrf52 board. The built-in cycle counter (CYCCNT) which is commonly used as a monotonic counter will not work when the debugger is not attached, which in turn will make scheduling operations not work as expected.


To use the the GlobalRollingTimer with RTIC, it first needs to be selected as the monotonic timer (here on top of the nrf52840 hal):

#[rtic::app(device = nrf52840_hal::pac, peripherals = true, monotonic = groundhog_nrf52::GlobalRollingTimer)]

During the init phase it needs to be initialized with a concrete timer implementation:

fn init(ctx: init::Context) -> init::LateResources {
    // using TIMER0 here
    // ...

Then, you can specify the schedule interval in microseconds as part of your task:

fn my_task(ctx: my_task::Context) {
        .my_task(ctx.scheduled + 1_000_000)

In this case the task will be scheduled again one second later.


A global rolling timer