File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -22,20 +22,18 @@ fn main() -> ! {
2222 let rcc = dp. RCC . constrain ( ) ;
2323 let ccdr = rcc. sys_ck ( 250 . MHz ( ) ) . freeze ( pwrcfg, & dp. SBS ) ;
2424
25- ccdr. peripheral . GPIOA . enable ( ) ;
26-
27- dp. GPIOA . moder ( ) . write ( |w| w. mode5 ( ) . output ( ) ) ; // output
28- dp. GPIOA . pupdr ( ) . write ( |w| w. pupd5 ( ) . pull_up ( ) ) ; // pull-up
25+ let gpioa = dp. GPIOA . split ( ccdr. peripheral . GPIOA ) ;
26+ let mut led = gpioa. pa5 . into_push_pull_output ( ) ;
2927
3028 let mut delay = Delay :: new ( cp. SYST , & ccdr. clocks ) ;
3129 let duration = SecsDurationU32 :: secs ( 1 ) . to_millis ( ) ;
3230
3331 loop {
34- dp. GPIOA . odr ( ) . write ( |w| w. od5 ( ) . low ( ) ) ;
35- delay. delay_ms ( duration) ;
32+ led. set_low ( ) ;
3633 log:: info!( "Off" ) ;
37- dp. GPIOA . odr ( ) . write ( |w| w. od5 ( ) . high ( ) ) ;
3834 delay. delay_ms ( duration) ;
35+ led. set_high ( ) ;
3936 log:: info!( "On" ) ;
37+ delay. delay_ms ( duration) ;
4038 }
4139}
You can’t perform that action at this time.
0 commit comments