1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//! "Blinky" using delays instead of a timer //! //! ``` //! //! #![deny(unsafe_code)] //! #![deny(warnings)] //! #![no_std] //! //! extern crate cortex_m; //! extern crate panic_abort; //! extern crate stm32f103xx_hal as hal; //! //! use hal::delay::Delay; //! use hal::prelude::*; //! use hal::stm32f103xx; //! //! fn main() { //! let dp = stm32f103xx::Peripherals::take().unwrap(); //! let cp = cortex_m::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 gpioc = dp.GPIOC.split(&mut rcc.apb2); //! //! let mut led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh); //! let mut delay = Delay::new(cp.SYST, clocks); //! //! loop { //! led.set_high(); //! delay.delay_ms(1_000_u16); //! led.set_low(); //! delay.delay_ms(1_000_u16); //! } //! } //! ``` // Auto-generated. Do not modify.