2014-03-06 07:02 AM
Hello,
I have 2 pins on the same port B defined to launch interrupt on RISE. When the interrupt is launched, how can I test which pin causes the interrupt launch ?GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_IN_FL_IT);
GPIO_Init(GPIOB, GPIO_PIN_6, GPIO_MODE_IN_FL_IT);
EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOB, EXTI_SENSITIVITY_RISE_ONLY);
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4)
{
if
(rise_of_PB5)
// how can I test if a rise of PB5 (and not PB6) launches the interrupt ???
{
//
}
if
(rise_of_PB6)
// how can I test if a rise of PB6 (and not PB5) launches the interrupt ???
{
//
}
}
Thanks in advance
#input-pin #interrupts #stm8
2014-10-31 11:37 AM
Here an example
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4)
{
data = GPIO_ReadInputData(GPIOB);
if((data == 0x10) || (data == 0x20)) //pin4, pin5
{
}
}