@@ -13,7 +13,6 @@ use panic_rtt_target as _;
13
13
// has instructions on how to connect to your Serial device (make sure to adjust the baud rate)
14
14
#[ rtic:: app( device = stm32f3xx_hal:: pac, dispatchers = [ TIM20_BRK , TIM20_UP , TIM20_TRG_COM ] ) ]
15
15
mod app {
16
- use dwt_systick_monotonic:: DwtSystick ;
17
16
use rtt_target:: { rprintln, rtt_init_print} ;
18
17
use stm32f3xx_hal:: {
19
18
gpio:: { self , Output , PushPull , AF7 } ,
@@ -22,9 +21,10 @@ mod app {
22
21
serial:: { Event , Serial } ,
23
22
Toggle ,
24
23
} ;
24
+ use systick_monotonic:: * ;
25
25
26
26
#[ monotonic( binds = SysTick , default = true ) ]
27
- type DwtMono = DwtSystick < 48_000_000 > ;
27
+ type AppMono = Systick < 100 > ; // 100 Hz / 10 ms granularity
28
28
29
29
type SerialType = Serial < pac:: USART1 , ( gpio:: PA9 < AF7 < PushPull > > , gpio:: PA10 < AF7 < PushPull > > ) > ;
30
30
// The LED that will light up when data is received via serial
@@ -43,16 +43,14 @@ mod app {
43
43
fn init ( cx : init:: Context ) -> ( Shared , Local , init:: Monotonics ) {
44
44
let mut flash = cx. device . FLASH . constrain ( ) ;
45
45
let mut rcc = cx. device . RCC . constrain ( ) ;
46
- let mut dcb = cx. core . DCB ;
47
- let dwt = cx. core . DWT ;
48
46
let systick = cx. core . SYST ;
49
47
50
48
rtt_init_print ! ( NoBlockSkip , 4096 ) ;
51
49
rprintln ! ( "pre init" ) ;
52
50
53
51
// Initialize the clocks
54
52
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 ) ;
56
54
57
55
// Initialize the peripherals
58
56
// DIR (the LED that lights up during serial rx)
0 commit comments