sleep.h File Reference

Energy Modes management driver. More...

#include <stdint.h>
#include <stdbool.h>
#include "em_device.h"
Include dependency graph for sleep.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define SLEEP_EM4_WAKEUP_CALLBACK_ENABLED   true
 Enable/disable the HW block for protecting accidental setting of low energy modes (recommended to be set to true).
#define SLEEP_LOWEST_ENERGY_MODE_DEFAULT   sleepEM3
 Configure default lowest energy mode that the system can be set to.

Typedefs

typedef void(* SLEEP_CbFuncPtr_t )(SLEEP_EnergyMode_t)
 Callback function pointer type.

Enumerations

enum  SLEEP_EnergyMode_t {
  sleepEM0 = 0,
  sleepEM1 = 1,
  sleepEM2 = 2,
  sleepEM3 = 3,
  sleepEM4 = 4
}
 

Status value used for showing the Energy Mode the device is currently in.

More...

Functions

void SLEEP_Init (SLEEP_CbFuncPtr_t pSleepCb, SLEEP_CbFuncPtr_t pWakeUpCb)
 Initialize the Sleep module.
SLEEP_EnergyMode_t SLEEP_LowestEnergyModeGet (void)
 Gets the lowest energy mode that the system is allowed to be set to.
SLEEP_EnergyMode_t SLEEP_Sleep (void)
 Sets the system to sleep into the lowest possible energy mode.
void SLEEP_ForceSleepInEM4 (void)
 Force the device to go to EM4 without doing any checks.
void SLEEP_SleepBlockBegin (SLEEP_EnergyMode_t eMode)
 Begin sleep block in the requested energy mode.
void SLEEP_SleepBlockEnd (SLEEP_EnergyMode_t eMode)
 End sleep block in the requested energy mode.

Detailed Description

Energy Modes management driver.

Version:
4.0.0

This is a energy modes management module consisting of sleep.c and sleep.h source files. The main purpose of the module is to ease energy optimization with a simple API. The module allows the system to always sleep in the lowest possible energy mode. Users could set up callbacks that are being called before and after each and every sleep. A counting semaphore is available for each low energy mode (EM1/EM2/EM3) to protect certain system states from being corrupted. This semaphore has limit set to maximum 255 locks.

The module provides the following public API to the users: SLEEP_Init() SLEEP_Sleep() SLEEP_SleepBlockBegin() SLEEP_SleepBlockEnd() SLEEP_ForceSleepInEM4()

License

(C) Copyright 2014 Silicon Labs, http://www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file sleep.h.