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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Blinks an LED
//!
//! ```
//! #![deny(unsafe_code)]
//! #![deny(warnings)]
//! #![no_std]
//! #![no_main]
//! 
//! extern crate cortex_m;
//! #[macro_use(entry, exception)]
//! extern crate cortex_m_rt as rt;
//! extern crate f3;
//! extern crate panic_semihosting;
//! 
//! use f3::hal::delay::Delay;
//! use f3::hal::prelude::*;
//! use f3::hal::stm32f30x;
//! use f3::led::Led;
//! use rt::ExceptionFrame;
//! 
//! entry!(main);
//! 
//! fn main() -> ! {
//!     let cp = cortex_m::Peripherals::take().unwrap();
//!     let dp = stm32f30x::Peripherals::take().unwrap();
//! 
//!     let mut flash = dp.FLASH.constrain();
//!     let mut rcc = dp.RCC.constrain();
//!     let mut gpioe = dp.GPIOE.split(&mut rcc.ahb);
//! 
//!     // clock configuration using the default settings (all clocks run at 8 MHz)
//!     let clocks = rcc.cfgr.freeze(&mut flash.acr);
//!     // TRY this alternate clock configuration (all clocks run at 16 MHz)
//!     // let clocks = rcc.cfgr.sysclk(16.mhz()).freeze(&mut flash.acr);
//! 
//!     let mut led: Led = gpioe
//!         .pe9
//!         .into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper)
//!         .into();
//!     let mut delay = Delay::new(cp.SYST, clocks);
//! 
//!     loop {
//!         led.on();
//!         delay.delay_ms(1_000_u16);
//!         led.off();
//!         delay.delay_ms(1_000_u16);
//!     }
//! }
//! 
//! exception!(HardFault, hard_fault);
//! 
//! fn hard_fault(ef: &ExceptionFrame) -> ! {
//!     panic!("{:#?}", ef);
//! }
//! 
//! exception!(*, default_handler);
//! 
//! fn default_handler(irqn: i16) {
//!     panic!("Unhandled exception (IRQn = {})", irqn);
//! }
//! ```
// Auto-generated. Do not modify.