1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 09:52:45 +01:00
RIOT/cpu/efm32/periph/pm.c

56 lines
1.3 KiB
C
Raw Normal View History

/*
2018-04-04 21:29:20 +02:00
* Copyright (C) 2017-2018 Bas Stottelaar <basstottelaar@gmail.com>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup cpu_efm32
* @ingroup drivers_periph_pm
* @{
*
* @file
* @brief Implementation of the power management peripheral
*
* @author Bas Stottelaar <basstottelaar@gmail.com>
* @}
*/
#include "periph/pm.h"
#include "em_emu.h"
2022-10-19 17:51:33 +02:00
#define ENABLE_DEBUG 0
#include "debug.h"
void pm_set(unsigned mode)
{
switch (mode) {
case EFM32_PM_MODE_EM3:
2022-10-19 17:51:33 +02:00
DEBUG_PUTS("[pm] enter EFM32_PM_MODE_EM3");
/* after exiting EM3, clocks are restored */
EMU_EnterEM3(true);
break;
case EFM32_PM_MODE_EM2:
2022-10-19 17:51:33 +02:00
DEBUG_PUTS("[pm] enter EFM32_PM_MODE_EM2");
/* after exiting EM2, clocks are restored */
EMU_EnterEM2(true);
break;
case EFM32_PM_MODE_EM1:
2022-10-19 17:51:33 +02:00
DEBUG_PUTS("[pm] enter EFM32_PM_MODE_EM1");
/* wait for next event or interrupt */
EMU_EnterEM1();
break;
default:
/* no sleep at all */
break;
}
}
2018-04-04 21:29:20 +02:00
void pm_off(void)
{
EMU_EnterEM4();
}