(Old) cellphones have a button to turn it on (when off), end a call (when on, short press) or turn it off (when on, long press).
I need something similar for a microcontroller. The device is battery-powered so the circuit should be as energy-efficient as possible. In addition to that, the fewer IO pins I have to use the better. I understand I need at least one as an input to read the state. Size isn't really an issue, but smaller is better.
The microcontroller in question is an XLP PIC16F1829. If I'd use a
SLEEP instructions and an input button on an interrupt pin, it would consume about 40uA in sleep, considering the peripherals I'm using. I hope I can get something drawing less current. The circuit should be energy-efficient when on as well.
What are some common energy efficient ways to make a one button on/off function with an extra option for a microcontroller?
As you can see, I already added a circuit myself. However, I don't know how energy-efficient it is when on, and there might be better options.