XMEGA Application Note | |||||
#include <stdint.h>
#include "avr_compiler.h"
Go to the source code of this file.
Defines | |
#define | SLEEPMGR_CTRL_REG SLEEP.CTRL |
Sleep mode control register. | |
#define | SLEEPMGR_DEFINE_MODES |
Sleep mode configuration values. | |
#define | SLEEPMGR_DISABLE_SLEEP() |
Disable sleep, so that subsequent sleep attempts will fail, until reenabled. | |
#define | SLEEPMGR_ENABLE_MASK SLEEP_SEN_bm |
Bitmask for Sleep Enable bit. | |
#define | SLEEPMGR_MODE_MASK SLEEP_SMODE_gm |
Bitmask for all sleep mode bits. | |
#define | SLEEPMGR_PREPARE_SLEEP(sleepMode) |
Prepare sleep configuration. Used before actually entering sleep mode. | |
Typedefs | |
typedef uint8_t | SLEEPMGR_lock_t |
Type holding sleep mode lock counts. This decides the maximum lock count. | |
typedef enum SLEEPMGR_mode_enum | SLEEPMGR_mode_t |
Sleep mode names. | |
Enumerations | |
enum | SLEEPMGR_mode_enum { SLEEPMGR_IDLE, SLEEPMGR_ESTDBY, SLEEPMGR_SAVE, SLEEPMGR_STDBY, SLEEPMGR_DOWN, SLEEPMGR_NUM_MODES } |
Sleep mode names. More... |
This file contains the configuration of the different sleep modes and their order of priority for the sleep manager.
Copyright (c) 2008, Atmel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The name of ATMEL may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file config_sleepmgr.h.
#define SLEEPMGR_CTRL_REG SLEEP.CTRL |
#define SLEEPMGR_DEFINE_MODES |
Value:
static uint8_t PROGMEM_DECLARE(SLEEPMGR_modes[SLEEPMGR_NUM_MODES]) = \ { \ SLEEP_SMODE_IDLE_gc, \ SLEEP_SMODE_ESTDBY_gc, \ SLEEP_SMODE_PSAVE_gc, \ SLEEP_SMODE_STDBY_gc, \ SLEEP_SMODE_PDOWN_gc \ };
This table is defined as a macro, which in turn is used in the sleepmgr.c file. It contains the sleep mode configuration values for all relevant sleep modes. Only include the sleep modes you intend to use, and make sure the shallowest (most "awake") sleep mode is the first one listed, and the deepest mode the last one listed. Do not include ACTIVE mode, as that is not regarded as a sleep mode as such. Make sure that the SLEEPMGR_mode_enum is updated accordingly.
Definition at line 107 of file config_sleepmgr.h.
#define SLEEPMGR_DISABLE_SLEEP | ( | ) |
Value:
{ \ SLEEPMGR_CTRL_REG &= ~SLEEPMGR_ENABLE_MASK; \ }
Definition at line 127 of file config_sleepmgr.h.
Referenced by SLEEPMGR_CancelSleep(), and SLEEPMGR_Sleep().
#define SLEEPMGR_ENABLE_MASK SLEEP_SEN_bm |
#define SLEEPMGR_MODE_MASK SLEEP_SMODE_gm |
#define SLEEPMGR_PREPARE_SLEEP | ( | sleepMode | ) |
Value:
{ \ SLEEPMGR_CTRL_REG = \ (SLEEPMGR_CTRL_REG & ~SLEEPMGR_MODE_MASK) | \ (sleepMode) | SLEEPMGR_ENABLE_MASK; \ }
Definition at line 119 of file config_sleepmgr.h.
Referenced by SLEEPMGR_Sleep().
typedef uint8_t SLEEPMGR_lock_t |
Type holding sleep mode lock counts. This decides the maximum lock count.
Definition at line 73 of file config_sleepmgr.h.
typedef enum SLEEPMGR_mode_enum SLEEPMGR_mode_t |
Sleep mode names.
This enumeration holds the identifiers used throughout the application to refer to sleep modes when locking and unlocking. Make sure the contents of this enumeration always correspond to the contents of the SLEEPMGR_modes[] table, which is defined below. Do not touch the last entry SLEEPMGR_NUM_MODES as it is used to indicate the number of sleep modes used in this application.
enum SLEEPMGR_mode_enum |
Sleep mode names.
This enumeration holds the identifiers used throughout the application to refer to sleep modes when locking and unlocking. Make sure the contents of this enumeration always correspond to the contents of the SLEEPMGR_modes[] table, which is defined below. Do not touch the last entry SLEEPMGR_NUM_MODES as it is used to indicate the number of sleep modes used in this application.
SLEEPMGR_IDLE | |
SLEEPMGR_ESTDBY | |
SLEEPMGR_SAVE | |
SLEEPMGR_STDBY | |
SLEEPMGR_DOWN | |
SLEEPMGR_NUM_MODES | Do not change! This equals the sleep mode count. |
Definition at line 83 of file config_sleepmgr.h.
00084 { 00085 SLEEPMGR_IDLE, 00086 SLEEPMGR_ESTDBY, 00087 SLEEPMGR_SAVE, 00088 SLEEPMGR_STDBY, 00089 SLEEPMGR_DOWN, 00090 SLEEPMGR_NUM_MODES 00091 } SLEEPMGR_mode_t;
Generated on Mon Nov 9 13:44:30 2009 for XMEGA power consumption evaluation code by ![]() |