File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -80,20 +80,21 @@ macro_rules! setup_uart {
8080
8181#[ entry]
8282fn main ( ) -> ! {
83- let dp = pac:: Peripherals :: take ( ) . unwrap ( ) ; // might as well panic if this doesn't work
84- let cp = cortex_m:: peripheral:: Peripherals :: take ( ) . unwrap ( ) ;
85- let mut flash = dp. FLASH ;
86- let mut rcc = dp. RCC . configure ( ) . sysclk ( 48 . mhz ( ) ) . freeze ( & mut flash) ;
83+ let mut delay = cortex_m:: interrupt:: free ( |cs| {
84+ let dp = pac:: Peripherals :: take ( ) . unwrap ( ) ; // might as well panic if this doesn't work
85+ let cp = cortex_m:: peripheral:: Peripherals :: take ( ) . unwrap ( ) ;
86+ let mut flash = dp. FLASH ;
87+ let mut rcc = dp. RCC . configure ( ) . sysclk ( 48 . mhz ( ) ) . freeze ( & mut flash) ;
8788
88- let gpioa = dp. GPIOA . split ( & mut rcc) ;
89- let gpiob = dp. GPIOB . split ( & mut rcc) ;
89+ let gpioa = dp. GPIOA . split ( & mut rcc) ;
90+ let gpiob = dp. GPIOB . split ( & mut rcc) ;
9091
91- let mut delay = Delay :: new ( cp. SYST , & rcc) ;
92-
93- cortex_m:: interrupt:: free ( |cs| {
92+ let delay = Delay :: new ( cp. SYST , & rcc) ;
9493 setup_uart ! ( cs, dp, rcc, gpioa) ;
9594
9695 init_global ! ( cs, LED , gpiob. pb3. into_push_pull_output( cs) ) ;
96+
97+ delay
9798 } ) ;
9899
99100 #[ allow( unsafe_code) ] // just this once ;)
You can’t perform that action at this time.
0 commit comments