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 {
80
80
81
81
#[ entry]
82
82
fn 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) ;
87
88
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) ;
90
91
91
- let mut delay = Delay :: new ( cp. SYST , & rcc) ;
92
-
93
- cortex_m:: interrupt:: free ( |cs| {
92
+ let delay = Delay :: new ( cp. SYST , & rcc) ;
94
93
setup_uart ! ( cs, dp, rcc, gpioa) ;
95
94
96
95
init_global ! ( cs, LED , gpiob. pb3. into_push_pull_output( cs) ) ;
96
+
97
+ delay
97
98
} ) ;
98
99
99
100
#[ allow( unsafe_code) ] // just this once ;)
You can’t perform that action at this time.
0 commit comments