//! Blinks an LED #![deny(unsafe_code)] #![deny(warnings)] #![no_std] #![no_main] extern crate panic_halt; use nb::block; use stm32f1xx_hal::{ prelude::*, pac, timer::Timer, }; use cortex_m_rt::entry; #[entry] fn main() -> ! { let cp = cortex_m::Peripherals::take().unwrap(); let dp = pac::Peripherals::take().unwrap(); let mut flash = dp.FLASH.constrain(); let mut rcc = dp.RCC.constrain(); // Try a different clock configuration let clocks = rcc.cfgr.freeze(&mut flash.acr); // let clocks = rcc.cfgr // .sysclk(64.mhz()) // .pclk1(32.mhz()) // .freeze(&mut flash.acr); let mut gpioc = dp.GPIOC.split(&mut rcc.apb2); let mut led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh); // Try a different timer (even SYST) let mut timer = Timer::syst(cp.SYST, 1.hz(), clocks); loop { block!(timer.wait()).unwrap(); led.set_high(); block!(timer.wait()).unwrap(); led.set_low(); } }