AVRPowerManager is an Arduino Library with the help of which one can shutdown a AVR Microcontroller trough code or special shutdown pattern read from the serial output of a 8 bit shift register, as the one present in the classic Nintendo NES controller. It uses Atmel's official <avr/sleep.h>
C++ sleep modes interfaces.
- Get reference to the shared instance from type
AVRPowerManager
withAVRPowerManager::shared()
- Call the
AVRPowerManager::shared()->shutdownIfNeeded(int8_t inputFromShiftRegister)
in the main aplication loop and optionally pass input from the shift register. The library checks for simultaneous presses of "start" + "select" buttons from NES Controller to trigger shutdown or auto shutdowns in after 2 mins. - Drive pin 2 (INT0) LOW to wake up the microcontroller.
- You can alter the behaviour for expected states and start states by changing the config in
AVRPowerManager.ccp
file.
For more information you can see the example from the library - "AVRPowerManagerNESController" which uses HEF4021BP
For detailed instructions check the official guides here
- Put the folder
AVRPowerManager
from the repo inside your "custom library" directory.- this directory is different for macOS, Linux and Windows. (checkout the official guides to find out where this directory is)
- You should now be able to see the new library AVRPowerManager in the libraries list.
- Choose the
Add Zip Library
option from insideSketch > Include Library > Add Zip Library...
- Select the zip file from the repo
AVRPowerManager.zip
- You should now be able to see the new library AVRPowerManager in the libraries list.
- in case of issues always double check your connections!