I’m trying to detect when a button (connected to a GPIO input) is held closed for a certain period of time, like a full second. I can create an interrupt handler that is called when the button is pressed or released, but reviewing the API docs, and my testing, indicates that I can not assign a different handler to an interrupt trigger by a press then one triggered by a release.
I could use the ISR to set a global flag when the button is pressed, and have a time going that periodically checks the value of the GPIO pin to see if the button is released and then compare times, but that seems rather awkward. Is there a better way?