Skip to content

Commit 2c3b8b7

Browse files
committed
Update rtic example
1 parent a45664f commit 2c3b8b7

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ panic-probe = "0.2.0"
5959
panic-semihosting = "0.5.6"
6060
usbd-serial = "0.1.1"
6161
usb-device = "0.2.8"
62-
cortex-m-rtic = "=0.6.0-rc.2"
63-
dwt-systick-monotonic = "=0.1.0-rc.1"
62+
cortex-m-rtic = "=0.6.0-rc.4, <0.6.0-rc.5"
63+
systick-monotonic = "0.1.0-rc.2"
6464
panic-rtt-target = { version = "0.1", features = ["cortex-m"] }
6565
rtt-target = { version = "0.3.0", features = ["cortex-m"] }
6666

examples/serial_echo_rtic.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use panic_rtt_target as _;
1313
// has instructions on how to connect to your Serial device (make sure to adjust the baud rate)
1414
#[rtic::app(device = stm32f3xx_hal::pac, dispatchers = [TIM20_BRK, TIM20_UP, TIM20_TRG_COM])]
1515
mod app {
16-
use dwt_systick_monotonic::DwtSystick;
1716
use rtt_target::{rprintln, rtt_init_print};
1817
use stm32f3xx_hal::{
1918
gpio::{self, Output, PushPull, AF7},
@@ -22,9 +21,10 @@ mod app {
2221
serial::{Event, Serial},
2322
Toggle,
2423
};
24+
use systick_monotonic::*;
2525

2626
#[monotonic(binds = SysTick, default = true)]
27-
type DwtMono = DwtSystick<48_000_000>;
27+
type AppMono = Systick<100>; // 100 Hz / 10 ms granularity
2828

2929
type SerialType = Serial<pac::USART1, (gpio::PA9<AF7<PushPull>>, gpio::PA10<AF7<PushPull>>)>;
3030
// The LED that will light up when data is received via serial
@@ -43,16 +43,14 @@ mod app {
4343
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
4444
let mut flash = cx.device.FLASH.constrain();
4545
let mut rcc = cx.device.RCC.constrain();
46-
let mut dcb = cx.core.DCB;
47-
let dwt = cx.core.DWT;
4846
let systick = cx.core.SYST;
4947

5048
rtt_init_print!(NoBlockSkip, 4096);
5149
rprintln!("pre init");
5250

5351
// Initialize the clocks
5452
let clocks = rcc.cfgr.sysclk(48.MHz()).freeze(&mut flash.acr);
55-
let mono = DwtSystick::new(&mut dcb, dwt, systick, clocks.sysclk().0);
53+
let mono = Systick::new(systick, 48_000_000);
5654

5755
// Initialize the peripherals
5856
// DIR (the LED that lights up during serial rx)

0 commit comments

Comments
 (0)