rtic_monotonics

Module rp2040

source
Expand description

Monotonic implementation for RP2040’s Timer peripheral.

Always runs at a fixed rate of 1 MHz.

§Example

use rtic_monotonics::rp2040::prelude::*;

rp2040_timer_monotonic!(Mono);

fn init() {
    // Start the monotonic
    Mono::start(timer, &mut resets);
}

async fn usage() {
    loop {
         // Use the monotonic
         let timestamp = Mono::now();
         Mono::delay(100.millis()).await;
    }
}

Modules§

  • Common definitions and traits for using the RP2040 timer monotonic

Structs§

  • RESETS
  • Controls time and alarms
    time is a 64 bit value indicating the time in usec since power-on
    timeh is the top 32 bits of time & timel is the bottom 32 bits
    to change time write to timelw before timehw
    to read time read from timelr before timehr
    An alarm is set by setting alarm_enable and writing to the corresponding alarm register
    When an alarm is pending, the corresponding alarm_running signal will be high
    An alarm can be cancelled before it has finished by clearing the alarm_enable
    When an alarm fires, the corresponding alarm_irq is set and alarm_running is cleared
    To clear the interrupt write a 1 to the corresponding alarm_irq
  • Timer implementing TimerQueueBackend.