Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let device = hal::stm32f30x::Peripherals::take().unwrap();
- let mut core = Peripherals::take().unwrap();
- // Configure PC13 as an input
- device.RCC.ahbenr.modify(|_, w| w.iopcen().set_bit());
- device.GPIOC.moder.modify(
- |_, w| w.moder13().input()
- );
- device.GPIOC.pupdr.modify(|_, w| unsafe {
- w.pupdr13().bits(0b01) // Pull-up
- });
- // Enable the EXTI13 interrupt
- core.NVIC.enable(
- stm32f30x::Interrupt::EXTI15_10,
- );
- // Connect GPIOC13 to EXTI13
- device.SYSCFG.exticr4.modify(|_, w| unsafe {
- w.exti13().bits(0b010)
- });
- // Enable interrupt on rise
- device.EXTI.imr1.modify(|_, w| w.mr13().set_bit());
- device.EXTI.emr1.modify(|_, w| w.mr13().set_bit());
- device.EXTI.rtsr1.modify(|_, w| w.tr13().set_bit());
Add Comment
Please, Sign In to add comment