Skip to content

Commit

Permalink
Update rtic example
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh3Rm4n committed Nov 16, 2021
1 parent a45664f commit 2c3b8b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ panic-probe = "0.2.0"
panic-semihosting = "0.5.6"
usbd-serial = "0.1.1"
usb-device = "0.2.8"
cortex-m-rtic = "=0.6.0-rc.2"
dwt-systick-monotonic = "=0.1.0-rc.1"
cortex-m-rtic = "=0.6.0-rc.4, <0.6.0-rc.5"
systick-monotonic = "0.1.0-rc.2"
panic-rtt-target = { version = "0.1", features = ["cortex-m"] }
rtt-target = { version = "0.3.0", features = ["cortex-m"] }

Expand Down
8 changes: 3 additions & 5 deletions examples/serial_echo_rtic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use panic_rtt_target as _;
// has instructions on how to connect to your Serial device (make sure to adjust the baud rate)
#[rtic::app(device = stm32f3xx_hal::pac, dispatchers = [TIM20_BRK, TIM20_UP, TIM20_TRG_COM])]
mod app {
use dwt_systick_monotonic::DwtSystick;
use rtt_target::{rprintln, rtt_init_print};
use stm32f3xx_hal::{
gpio::{self, Output, PushPull, AF7},
Expand All @@ -22,9 +21,10 @@ mod app {
serial::{Event, Serial},
Toggle,
};
use systick_monotonic::*;

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

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

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

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

// Initialize the peripherals
// DIR (the LED that lights up during serial rx)
Expand Down

0 comments on commit 2c3b8b7

Please sign in to comment.