aboutsummaryrefslogtreecommitdiff
path: root/rtic-monotonics/src/rp2040.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rtic-monotonics/src/rp2040.rs')
-rw-r--r--rtic-monotonics/src/rp2040.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/rtic-monotonics/src/rp2040.rs b/rtic-monotonics/src/rp2040.rs
index 6599dc6..93472e6 100644
--- a/rtic-monotonics/src/rp2040.rs
+++ b/rtic-monotonics/src/rp2040.rs
@@ -11,7 +11,11 @@ pub struct Timer;
impl Timer {
/// Start a `Monotonic` based on RP2040's Timer.
- pub fn start(timer: TIMER, resets: &mut RESETS) {
+ pub fn start(
+ timer: TIMER,
+ resets: &mut RESETS,
+ _interrupt_token: impl crate::InterruptToken<Self>,
+ ) {
resets.reset.modify(|_, w| w.timer().clear_bit());
while resets.reset_done.read().timer().bit_is_clear() {}
timer.inte.modify(|_, w| w.alarm_0().set_bit());
@@ -136,10 +140,21 @@ impl embedded_hal_async::delay::DelayUs for Timer {
#[macro_export]
macro_rules! make_rp2040_monotonic_handler {
() => {
+ {
#[no_mangle]
#[allow(non_snake_case)]
unsafe extern "C" fn TIMER_IRQ_0() {
rtic_monotonics::rp2040::Timer::__tq().on_monotonic_interrupt();
}
+
+ pub struct Rp2040Token;
+
+ unsafe impl rtic_monotonics::InterruptToken<rtic_monotonics::rp2040::Timer>
+ for Rp2040Token
+ {
+ }
+
+ Rp2040Token
+ }
};
}