1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #![no_main]
- #![no_std]
- #[allow(unused_extern_crates)]
- use panic_halt as _;
- use cortex_m::peripheral::syst::SystClkSource;
- use cortex_m_rt::entry;
- use cortex_m_semihosting::hprint;
- use stm32f3::stm32f303::{interrupt, Interrupt, NVIC};
- #[entry]
- fn main() -> ! {
- let p = cortex_m::Peripherals::take().unwrap();
- let mut syst = p.SYST;
- let mut nvic = p.NVIC;
- nvic.enable(Interrupt::EXTI0);
-
- syst.set_clock_source(SystClkSource::Core);
- syst.set_reload(8_000_000);
- syst.enable_counter();
- loop {
-
- while !syst.has_wrapped() {}
-
- NVIC::pend(Interrupt::EXTI0);
- }
- }
- #[interrupt]
- fn EXTI0() {
- hprint!(".").unwrap();
- }
|