# sleep.c File Reference

Energy Modes management driver. More...

`#include "em_device.h"`
`#include "em_assert.h"`
`#include "em_int.h"`
`#include "em_rmu.h"`
`#include "em_emu.h"`
`#include "sleep.h"`
`#include <stdlib.h>`
Include dependency graph for sleep.c:

Go to the source code of this file.

## 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.

## Detailed Description

Energy Modes management driver.

Author:
  Energy Micro AS

Version:
  3.20.2

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 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.c.