diff --git a/examples/blinky.rs b/examples/blinky.rs index b3110a1..8afa501 100644 --- a/examples/blinky.rs +++ b/examples/blinky.rs @@ -22,20 +22,18 @@ fn main() -> ! { let rcc = dp.RCC.constrain(); let ccdr = rcc.sys_ck(250.MHz()).freeze(pwrcfg, &dp.SBS); - ccdr.peripheral.GPIOA.enable(); - - dp.GPIOA.moder().write(|w| w.mode5().output()); // output - dp.GPIOA.pupdr().write(|w| w.pupd5().pull_up()); // pull-up + let gpioa = dp.GPIOA.split(ccdr.peripheral.GPIOA); + let mut led = gpioa.pa5.into_push_pull_output(); let mut delay = Delay::new(cp.SYST, &ccdr.clocks); let duration = SecsDurationU32::secs(1).to_millis(); loop { - dp.GPIOA.odr().write(|w| w.od5().low()); - delay.delay_ms(duration); + led.set_low(); log::info!("Off"); - dp.GPIOA.odr().write(|w| w.od5().high()); delay.delay_ms(duration); + led.set_high(); log::info!("On"); + delay.delay_ms(duration); } }