GPIO interrupt triggered incorrectly
I am using micro switches in my system with the GPIO EXTI. I would like to detect only the press of the switch, but the interrupt was triggered on both press and release of the switch. The interrupts were even triggered twice on each press and release.
Here is my configuration of the pin. PC9 on the STM32H563ZI board is used. The GPIO pin is set as below, and the EXTI LINE9 Interrupt is checked in the NVIC setting.

And here is the code:
void HAL_GPIO_EXTI_Falling_Callback(uint16_t GPIO_Pin)
{
printf("%d\n", GPIO_Pin);
}
Does any one know what's happening and how to fix it?
