For various reasons, i'd like my ATMega to control its own power availability, that is: to have a momentary contact push button used to switch the power on, then have the ATMega control how long the power stays on, and when it is powered off. A bit like a PC where you hold the power switch down for 4 seconds or so to do a hard power down.
I'd like the push button used for this to be capable of being sensed by the ATMega even when the system is powered up and running (so i can detect a subsequent button press).
i don't have much room on the PCB, and would prefer not to use an electromechanical relay etc., but cheap semiconductor components, or a dedicated IC if such a thing exists (i haven't been able to find a suitable one). It must have very low leakage current as i want to be able to keep the device powered down for long periods (up to a month) without running the battery down.
Does anyone know of an IC that does this, or can anyone recommend/design a circuit for this?
Many Thanks...