I have a problem is that the interruption is triggered several times as long as the push button pressed while I want the interruption to be triggered only once even if the button has been pressed
i have a matrix keyboard and i want to read their buttons. I followed the algorithm of the keyboard: the lines are outputs initialized in the high state and the columns are inputs with pulldown resistances, when an interruption occurs on a column I put 1 logic on the first line and 0 logic on the other lines, if I find 1 logic on the column then I know which button is pressed and so on. when I remain pressed on one of the buttons of the 1st line everything is working well and the interrupt is triggered only once but when I remain pressed on one of the buttons of one of the other lines the intrusion remains triggered several times
/ /初始化OUTPUT Up setSelectedKeypadMatrixRowsUp(_ROW_1 | _ROW_2 | _ROW_3 | _ROW_4);
Hi There,
Do you mean to disable the global interrupts?
Thanks, PM_Dialog
I have a problem is that the interruption is triggered several times as long as the push button pressed while I want the interruption to be triggered only once even if the button has been pressed
我用GPIO中断:
GPIO_RegisterCallback(GPIO0_IRQn,callback_function);
GPIO_EnableIRQ(GPIO_BUTTON_1_PORT, GPIO_BUTTON_1_PIN, GPIO0_IRQn, true ,false, 250);
GPIO_ResetIRQ (GPIO0_IRQn);
Hi There,
Could you please try to explain what you are trying to accomplish?
Thanks, PM_Dialog
i have a matrix keyboard and i want to read their buttons. I followed the algorithm of the keyboard: the lines are outputs initialized in the high state and the columns are inputs with pulldown resistances, when an interruption occurs on a column I put 1 logic on the first line and 0 logic on the other lines, if I find 1 logic on the column then I know which button is pressed and so on. when I remain pressed on one of the buttons of the 1st line everything is working well and the interrupt is triggered only once but when I remain pressed on one of the buttons of one of the other lines the intrusion remains triggered several times
/ /初始化OUTPUT Up
setSelectedKeypadMatrixRowsUp(_ROW_1 | _ROW_2 | _ROW_3 | _ROW_4);
GPIO_EnableIRQ(GPIO_KEYPAD_C1_PORT, GPIO_KEYPAD_C1_PIN, GPIO0_IRQn, false ,true, 250);
GPIO_RegisterCallback(GPIO0_IRQn,C1_KeypadInterruptHandler);
__STATIC_INLINE void C1_KeypadInterruptHandler (void)
{
setSelectedKeypadMatrixRowsUp(_ROW_1);
if(_COL_1)
{
arch_printf("Keypad 1\n\r");
goto reset;
}
setSelectedKeypadMatrixRowsUp(_ROW_2);
if(_COL_1)
{
arch_printf("Keypad 4\n\r");
goto reset;
}
setSelectedKeypadMatrixRowsUp(_ROW_3);
if(_COL_1)
{
arch_printf("Keypad 7\n\r");
goto reset;
}
setSelectedKeypadMatrixRowsUp(_ROW_4);
if(_COL_1)
{
arch_printf("Keypad *\n\r");
goto reset;
}
reset :
setSelectedKeypadMatrixRowsUp(_ROW_1 | _ROW_2 | _ROW_3 | _ROW_4);
}
__STATIC_INLINE void setSelectedKeypadMatrixRowsUp(int aMask)
{
if(aMask & _ROW_1)
_ROW_1_HIGH;
else
_ROW_1_LOW;
if(aMask & _ROW_2)
_ROW_2_HIGH;
else
_ROW_2_LOW;
if(aMask & _ROW_3)
_ROW_3_HIGH;
else
_ROW_3_LOW;
if(aMask & _ROW_4)
_ROW_4_HIGH;
else
_ROW_4_LOW;
}
Hi There,
Sorry for my delayed response – probably we missed your last comments. You could use the IRQ APIs from the gpio.h driver.
Thanks, PM_Dialog