#![no_main] #![no_std] #[allow(unused)] use panic_halt; use nucleo_f103rb as board; use board::hal::{prelude::*, stm32, timer::Timer}; use cortex_m_rt::entry; use nb::block; #[entry] fn main() -> ! { let cp = cortex_m::Peripherals::take().unwrap(); let dp = stm32::Peripherals::take().unwrap(); let mut flash = dp.FLASH.constrain(); let mut rcc = dp.RCC.constrain(); let clocks = rcc.cfgr.freeze(&mut flash.acr); let mut gpioa = dp.GPIOA.split(&mut rcc.apb2); let mut led = gpioa.pa5.into_push_pull_output(&mut gpioa.crl); let mut timer = Timer::syst(cp.SYST, 2.hz(), clocks); loop { block!(timer.wait()).unwrap(); led.set_high(); block!(timer.wait()).unwrap(); led.set_low(); } }