File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -69,3 +69,7 @@ codegen-units = 1 # better optimizations
6969debug = true # symbols are nice and they don't increase the size in flash
7070lto = true # better optimizations
7171opt-level = " s" # optimize for binary size
72+
73+ [[example ]]
74+ name = " blinky"
75+ required-features = [" stm32h503" ]
Original file line number Diff line number Diff line change 1+ #![ deny( warnings) ]
12#![ no_main]
23#![ no_std]
34
@@ -6,7 +7,7 @@ mod utilities;
67use cortex_m_rt:: entry;
78use embedded_hal:: delay:: DelayNs ;
89use fugit:: SecsDurationU32 ;
9- use stm32h5xx_hal:: { delay:: Delay , pac, prelude:: * , rcc :: ResetEnable } ;
10+ use stm32h5xx_hal:: { delay:: Delay , pac, prelude:: * } ;
1011
1112#[ entry]
1213fn main ( ) -> ! {
@@ -22,20 +23,18 @@ fn main() -> ! {
2223 let rcc = dp. RCC . constrain ( ) ;
2324 let ccdr = rcc. sys_ck ( 250 . MHz ( ) ) . freeze ( pwrcfg, & dp. SBS ) ;
2425
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
26+ let gpioa = dp. GPIOA . split ( ccdr. peripheral . GPIOA ) ;
27+ let mut led = gpioa. pa5 . into_push_pull_output ( ) ;
2928
3029 let mut delay = Delay :: new ( cp. SYST , & ccdr. clocks ) ;
3130 let duration = SecsDurationU32 :: secs ( 1 ) . to_millis ( ) ;
3231
3332 loop {
34- dp. GPIOA . odr ( ) . write ( |w| w. od5 ( ) . low ( ) ) ;
35- delay. delay_ms ( duration) ;
33+ led. set_low ( ) ;
3634 log:: info!( "Off" ) ;
37- dp. GPIOA . odr ( ) . write ( |w| w. od5 ( ) . high ( ) ) ;
3835 delay. delay_ms ( duration) ;
36+ led. set_high ( ) ;
3937 log:: info!( "On" ) ;
38+ delay. delay_ms ( duration) ;
4039 }
4140}
You can’t perform that action at this time.
0 commit comments