123456789101112131415161718192021222324252627282930313233343536 |
- //! Turns the user LED on
- #![deny(unsafe_code)]
- #![deny(warnings)]
- #![no_main]
- #![no_std]
- extern crate cortex_m_rt as rt;
- extern crate panic_semihosting;
- extern crate stm32f1xx_hal as hal;
- use hal::prelude::*;
- use hal::stm32f103xx;
- use rt::{entry, exception, ExceptionFrame};
- #[entry]
- fn main() -> ! {
- let p = stm32f103xx::Peripherals::take().unwrap();
- let mut rcc = p.RCC.constrain();
- let mut gpioc = p.GPIOC.split(&mut rcc.apb2);
- gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
- loop {}
- }
- #[exception]
- fn HardFault(ef: &ExceptionFrame) -> ! {
- panic!("{:#?}", ef);
- }
- #[exception]
- fn DefaultHandler(irqn: i16) {
- panic!("Unhandled exception (IRQn = {})", irqn);
- }
|