1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-28 07:51:19 +01:00

cpu/sam0_common: implement pm_off()

This commit is contained in:
Benjamin Valentin 2020-09-10 13:51:15 +02:00
parent 80ea84d570
commit fea0e0f34c
2 changed files with 45 additions and 0 deletions

View File

@ -598,6 +598,20 @@ typedef struct {
*/
void gpio_init_mux(gpio_t pin, gpio_mux_t mux);
#ifdef PM_SLEEPCFG_SLEEPMODE_OFF
/**
* @brief CPU provides own pm_off() function
*/
# define PROVIDES_PM_OFF
/**
* @brief CPU provides own pm_off() function
*/
# define PROVIDES_PM_LAYERED_OFF
#endif /* PM_SLEEPCFG_SLEEPMODE_OFF */
/**
* @brief Called before the power management enters a power mode
*

View File

@ -0,0 +1,31 @@
/*
* SPDX-FileCopyrightText: 2020 ML!PA Consulting GmbH
* SPDX-License-Identifier: LGPL-2.1-only
*/
/**
* @ingroup cpu_sam0_common
* @ingroup drivers_periph_pm
* @{
*
* @file
* @brief Implementation of pm_off()
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*
* @}
*/
#include "periph/pm.h"
#ifdef PM_SLEEPCFG_SLEEPMODE_OFF
void pm_off(void)
{
irq_disable();
PM->SLEEPCFG.bit.SLEEPMODE = PM_SLEEPCFG_SLEEPMODE_OFF;
while (PM->SLEEPCFG.bit.SLEEPMODE != PM_SLEEPCFG_SLEEPMODE_OFF) {}
cortexm_sleep(1);
}
#endif