diff --git a/cpu/efm32/include/periph_cpu.h b/cpu/efm32/include/periph_cpu.h index 8df5ecada2..f574feb178 100644 --- a/cpu/efm32/include/periph_cpu.h +++ b/cpu/efm32/include/periph_cpu.h @@ -455,6 +455,15 @@ typedef struct { */ #define PM_NUM_MODES (3U) +/** + * @name Available power modes + * @{ + */ +#define EFM32_PM_MODE_EM3 (0U) /**< CPU sleeps, peripherals in EM3 domain are active */ +#define EFM32_PM_MODE_EM2 (1U) /**< CPU sleeps, peripherals in EM2 + EM3 domain are active */ +#define EFM32_PM_MODE_EM1 (2U) /**< CPU sleeps, all peripherals are active */ +/** @} */ + /** * @name Watchdog timer (WDT) configuration * @{ diff --git a/cpu/efm32/periph/pm.c b/cpu/efm32/periph/pm.c index 4a9aaef707..122d4e93a7 100644 --- a/cpu/efm32/periph/pm.c +++ b/cpu/efm32/periph/pm.c @@ -25,14 +25,15 @@ void pm_set(unsigned mode) { switch (mode) { - case 0: + case EFM32_PM_MODE_EM3: /* after exiting EM3, clocks are restored */ EMU_EnterEM3(true); break; - case 1: + case EFM32_PM_MODE_EM2: /* after exiting EM2, clocks are restored */ EMU_EnterEM2(true); break; + case EFM32_PM_MODE_EM1: default: /* wait for next event or interrupt */ EMU_EnterEM1();