Many electronic devices turn on/off, or more correctly on/sleep, by pressing a button and holding it for two or three seconds. I would like to put this ability into a project using an Adafruit Feather board. The sleep side is easy, I can detect a level and if it stays there for some time, run the code to put the processor to sleep. My question involves the wake up side. The chip wakes up via an interrupt.
The question then becomes, how do I generate the interrupt source only after the button has been held for the designated time? I've considered two options:
1) Use a level interrupt and an RC circuit to do the delay. 2) Have the processor wake up immediately and then implement logic to determine if it has been held "long enough" and go back to sleep if not.
Am I missing an easy option? Is there a general consensus on the best way to do this? It seems like such a normal thing that I'm surprised my searches haven't turned up any tutorials.