I'm trying to debounce a mechanical switch hooked up to an FTM pin configured for input capture. I would like to trigger an action on the falling edge. My idea was to set up the input capture interrupt to trigger on the rising and falling edge, and start a software timer (using FreeRTOS) on every falling edge, and resetting it on every rising edge. Once the software timer successfully completes, after the switch is done bouncing, I would trigger the action.
My problem is I can't figure out how to detect if the interrupt is being triggered from the rising or falling edge when configured in this mode. Is there a way to do this? Or is there a better way for me to debounce the switch? I figure I could do something similar using GPIO interrupts as well.
I am using a K66 and KSDK2.0.
Any help would be greatly appreciated,