Energy Modes management driver. More...
#include <stdint.h>
#include <stdbool.h>
#include "em_device.h"
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_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. |
Energy Modes management driver.
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()
(C) Copyright 2013 Energy Micro AS, http://www.energymicro.com
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. 4. The source and compiled code may only be used on Energy Micro "EFM32" microcontrollers and "EFR4" radios.
DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no obligation to support this Software. Energy Micro AS is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.
Energy Micro AS will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.
Definition in file sleep.h.