Hello!! what is wrong ? I want to do an external interrupt with button (gpio A0) to turn on the led (gpio D14) (STM32F407DISC) and do not work..
void init_led(){
RCC->AHB1ENR|=0x8;
GPIOD->MODER|=0x10000000;
}
void led_on(){
GPIOD->ODR |= 0x4000;
}
void led_off(){
GPIOD->ODR &= 0xBFFF;
}
void init_button(){
RCC->AHB1ENR|=0X1; //ENABLE CLOCK TO GPIOA
GPIOA->MODER &= ~0x03; // make gpioa0 mode input
EXTI->FTSR |=0x01;
EXTI->IMR |=0x1;
// EXTI->EMR |=0x1;
NVIC->ISER[0] |=(1<EXTI0_IRQn);
}
void EXTI0_IRQHandler(){
if ((EXTI->PR & 0x01)){
EXTI->PR = 0x01;
led_on();
}
}
void init_syscfg(){
RCC->APB2ENR|=0x4000;
(*((uint32_t*)0x40013808)) &= ~0x15;
}
int main(void)
{
init_button();
init_syscfg();
init_led();
while (1)
{
}
}
