aboutsummaryrefslogtreecommitdiff
path: root/rtic-monotonics/src/rp2040.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-03-11 20:18:58 +0000
committerGitHub <noreply@github.com>2023-03-11 20:18:58 +0000
commit534d42edf5505950a87f2621df883ceac4957156 (patch)
tree1636806eebc89750e199ebaa5e021d83041a01cd /rtic-monotonics/src/rp2040.rs
parentdd899ab77f3d95ebb04fb8b02eadf6275d7524ac (diff)
parente4d9284e258a34b10cac2eff47ca2ccb470b460c (diff)
Merge #702
702: Monotonics interrupt token r=AfoHT a=korken89 Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
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
+ }
};
}