I am working on a project with KW41Z. I am trying to get 2 external interrupts from SW3 and SW4 buttons. When I tried this example it didn't work at all.
Sometimes I get a print on button push SW3 but it doesn't work when I push the button again. I cant understand why the same code sometimes works and sometimes doesn't.
Furthermore I saw this post Input interrupt Handler example on KW41Z and I cant get both buttons working. Shouldn't this be working if I add these lines of code (since both buttons have the same handler)?
PORT_SetPinInterruptConfig(BOARD_SW_PORT, BOARD_SW4_GPIO_PIN, kPORT_InterruptFallingEdge);
GPIO_PinInit(BOARD_SW_GPIO, BOARD_SW4_GPIO_PIN, &sw_config);
Hi kostas,
Please refer the init codes of PTC4. If not the PTC5 is disable by default.
GPIO_GetPinsInterruptFlags should be use to check which SW caused interrupt, and then clear the corresponding interrupt flag.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------