Hi all
Any advice on using interupts to wake from sleep AND multifunction buttons?
Examples I have found seem to count time and debounce, returning the sort of button press. However I have not seen any examples used in conjunction with low power sleep libs.
I want a button that wakes from sleep and depending on how it is pressed, runs functions that reconfigure the runtime.
Eg
Short press - ACK
Long press - flip mode
Really long press - enter setup mode
Thought / ideas welcome
Waking from a pinChangeInt(errupt) is easy, debounce logic can occur after you wakeup (disable the pinChange interrupt as soon as you get the first one, that way you won't get extra interrupts as the switch bounces).
Test with a really noisy switch (like those really cheesy ones that feel like there's sand inside when you press it)! Tough to discriminate a short press with these, but, if they occur between large intervals then it's relatively easy. (ie, 'any' press is a short press if it doesn't meet the long press requirements)
Tom (just flipping out ideas)