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:
parent
80ea84d570
commit
fea0e0f34c
@ -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
|
||||
*
|
||||
|
||||
31
cpu/sam0_common/periph/pm.c
Normal file
31
cpu/sam0_common/periph/pm.c
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user