Skip to content

Commit 2c295af

Browse files
committed
rtic_v2: rp2040: Use of TIMER monotonic instead of SYSTICK
1 parent a5bfeb8 commit 2c295af

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

rtic_v2/rp2040_local_i2c_init/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ edition = "2021"
88

99
[dependencies]
1010
cortex-m = "0.7"
11-
rtic = { git = "https://github.com/rtic-rs/rtic", features = ["thumbv6-backend"] }
12-
rtic-monotonics = { git = "https://github.com/rtic-rs/rtic", features = ["cortex-m-systick", "rp2040"] }
11+
rtic = { git = "https://github.com/rtic-rs/rtic", features = [
12+
"thumbv6-backend",
13+
] }
14+
rtic-monotonics = { git = "https://github.com/rtic-rs/rtic", features = [
15+
"rp2040",
16+
] }
1317
embedded-hal = { version = "0.2.7", features = ["unproven"] }
1418
fugit = "0.3"
1519
rp-pico = "0.7.0"

rtic_v2/rp2040_local_i2c_init/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ mod app {
2121
use core::mem::MaybeUninit;
2222
use embedded_hal::digital::v2::{OutputPin, ToggleableOutputPin};
2323
use fugit::RateExtU32;
24-
use rtic_monotonics::systick::*;
24+
use rtic_monotonics::rp2040::*;
2525

2626
use panic_probe as _;
2727

28-
rtic_monotonics::make_systick_handler!();
28+
rtic_monotonics::make_rp2040_monotonic_handler!();
2929

3030
type I2CBus = I2C<
3131
pac::I2C1,
@@ -52,7 +52,7 @@ mod app {
5252
])]
5353
fn init(mut ctx: init::Context) -> (Shared, Local) {
5454
// Configure the clocks, watchdog - The default is to generate a 125 MHz system clock
55-
Systick::start(ctx.core.SYST, 125_000_000); // default rp2040 clock-rate is 125MHz
55+
Timer::start(ctx.device.TIMER, &mut ctx.device.RESETS); // default rp2040 clock-rate is 125MHz
5656
let mut watchdog = Watchdog::new(ctx.device.WATCHDOG);
5757
let clocks = clocks::init_clocks_and_plls(
5858
XOSC_CRYSTAL_FREQ,
@@ -109,6 +109,6 @@ mod app {
109109
// now to do something with it!
110110

111111
// Re-spawn this task after 1 second
112-
Systick::delay(1000.millis()).await;
112+
Timer::delay(1000.millis()).await;
113113
}
114114
}

0 commit comments

Comments
 (0)