1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

Merge pull request #11202 from bergzand/pr/samd21/expose_pm_states

samd21: Expose PM states
This commit is contained in:
Koen Zandberg 2019-03-18 15:39:07 +01:00 committed by GitHub
commit 611d268ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -34,6 +34,16 @@ extern "C" {
*/
#define PM_BLOCKER_INITIAL { .val_u32 = 0x00000001 }
/**
* @name SAMD21 sleep modes for PM
* @{
*/
#define SAMD21_PM_STANDBY (0U) /**< Standby mode (stops main clock) */
#define SAMD21_PM_IDLE_2 (1U) /**< Idle 2 (stops AHB, APB and CPU) */
#define SAMD21_PM_IDLE_1 (2U) /**< Idle 1 (stops AHB and CPU) */
#define SAMD21_PM_IDLE_0 (3U) /**< Idle 0 (stops CPU) */
/** @} */
/**
* @brief Mapping of pins to EXTI lines, -1 means not EXTI possible
*/

View File

@ -56,25 +56,25 @@ void pm_set(unsigned mode)
int deep = 0;
switch (mode) {
case 0:
case SAMD21_PM_STANDBY:
/* Standby Mode
* Potential Wake Up sources: asynchronous
*/
deep = 1;
break;
case 1:
case SAMD21_PM_IDLE_2:
/* Sleep mode Idle 2
* Potential Wake Up sources: asynchronous
*/
PM->SLEEP.reg = SYSTEM_SLEEPMODE_IDLE_2;
break;
case 2:
case SAMD21_PM_IDLE_1:
/* Sleep mode Idle 1
* Potential Wake Up sources: Synchronous (APB), asynchronous
*/
PM->SLEEP.reg = SYSTEM_SLEEPMODE_IDLE_1;
break;
case 3:
case SAMD21_PM_IDLE_0:
/* Sleep mode Idle 0
* Potential Wake Up sources: Synchronous (APB, AHB), asynchronous
*/