2020-09-04 07:13 AM
#include "main.h"
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
while (1)
{
}
}
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(GPIO_Pin == GPIO_PIN_9) // If The INT Source Is EXTI Line9 (A9 Pin)
{
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_10); // Toggle The Output (LED) Pin
}
}
2020-09-04 12:38 PM
The code you posted looks fine. There's a lot of other code that isn't shown that is required to make it work, but CubeMX should generally set that up for you. The EXTIx_IRQHandler should be called which will then call a HAL function to handle the interrupt.
Include some more details on what you've tried and what "isn't working" means in particular.