XMEGA Application Note


config_sleepmgr.h

Go to the documentation of this file.
00001 // This file has been prepared for Doxygen automatic documentation generation.
00050 #ifndef CONFIG_SLEEPMGR_H
00051 #define CONFIG_SLEEPMGR_H
00052 
00053 /*============================ INCLUDES ======================================*/
00054 #include <stdint.h>
00055 #include "avr_compiler.h"
00056 
00057 
00058 
00059 /*============================ DEFINITIONS ===================================*/
00060 
00062 #define SLEEPMGR_CTRL_REG SLEEP.CTRL
00064 #define SLEEPMGR_ENABLE_MASK SLEEP_SEN_bm
00066 #define SLEEPMGR_MODE_MASK SLEEP_SMODE_gm
00067 
00068 
00069 
00070 /*============================ TYPES =========================================*/
00071 
00073 typedef uint8_t SLEEPMGR_lock_t;
00074 
00083 typedef enum SLEEPMGR_mode_enum
00084 {
00085         SLEEPMGR_IDLE,
00086         SLEEPMGR_ESTDBY,
00087         SLEEPMGR_SAVE,
00088         SLEEPMGR_STDBY,
00089         SLEEPMGR_DOWN,
00090         SLEEPMGR_NUM_MODES 
00091 } SLEEPMGR_mode_t;
00092 
00093 
00094 
00095 /*============================ MACROS ========================================*/
00096 
00107 #define SLEEPMGR_DEFINE_MODES \
00108 static uint8_t PROGMEM_DECLARE(SLEEPMGR_modes[SLEEPMGR_NUM_MODES]) = \
00109 { \
00110         SLEEP_SMODE_IDLE_gc, \
00111         SLEEP_SMODE_ESTDBY_gc, \
00112         SLEEP_SMODE_PSAVE_gc, \
00113         SLEEP_SMODE_STDBY_gc, \
00114         SLEEP_SMODE_PDOWN_gc \
00115 };
00116 
00117 
00119 #define SLEEPMGR_PREPARE_SLEEP( sleepMode ) \
00120 { \
00121         SLEEPMGR_CTRL_REG = \
00122                 (SLEEPMGR_CTRL_REG & ~SLEEPMGR_MODE_MASK) | \
00123                 (sleepMode) | SLEEPMGR_ENABLE_MASK; \
00124 }
00125 
00127 #define SLEEPMGR_DISABLE_SLEEP() \
00128 { \
00129         SLEEPMGR_CTRL_REG &= ~SLEEPMGR_ENABLE_MASK; \
00130 }
00131 
00132 
00133 #endif
00134 /* EOF */
@DOC_TITLE@
Generated on Mon Nov 9 13:44:26 2009 for XMEGA power consumption evaluation code by doxygen 1.5.9