How to configure external interrupt lines.
In this example, one EXTI line (EXTI_Line4) is configured to generate an interrupt on each falling edge. In the interrupt routine a led connected to a specific GPIO pin is toggled.
In this example:
On STM32C0316-DISCO:
In this example, HCLK is configured at 48 MHz.
Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds) based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower) than the peripheral interrupt. Otherwise the caller ISR process will be blocked. To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.
The example needs to ensure that the SysTick time base is always set to 1 millisecond to have correct HAL operation.
System, GPIO, EXTI, Output, Alternate function, Push-pull, Toggle
This example runs on STM32C031C6Tx devices.
This example has been tested with STM32C0316-DISCO board and can be easily tailored to any other supported device and development board.
In order to make the program work, you must do the following :