mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/saml1x, saml2x: PM_NUM_MODES is a valid mode
The mode PM_NUM_MODES is the IDLE mode, so do not skip it.
This commit is contained in:
parent
5d123cbb22
commit
7e156dd2e5
@ -26,26 +26,24 @@
|
||||
|
||||
void pm_set(unsigned mode)
|
||||
{
|
||||
if (mode < PM_NUM_MODES) {
|
||||
uint32_t _mode;
|
||||
uint32_t _mode;
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
DEBUG_PUTS("pm_set(): setting STANDBY mode.");
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_STANDBY;
|
||||
break;
|
||||
default: /* Falls through */
|
||||
case 1:
|
||||
DEBUG_PUTS("pm_set(): setting IDLE mode.");
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* write sleep configuration */
|
||||
PM->SLEEPCFG.bit.SLEEPMODE = _mode;
|
||||
/* make sure value has been set */
|
||||
while (PM->SLEEPCFG.bit.SLEEPMODE != _mode) {}
|
||||
switch (mode) {
|
||||
case 0:
|
||||
DEBUG_PUTS("pm_set(): setting STANDBY mode.");
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_STANDBY;
|
||||
break;
|
||||
default: /* Falls through */
|
||||
case 1:
|
||||
DEBUG_PUTS("pm_set(): setting IDLE mode.");
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* write sleep configuration */
|
||||
PM->SLEEPCFG.bit.SLEEPMODE = _mode;
|
||||
/* make sure value has been set */
|
||||
while (PM->SLEEPCFG.bit.SLEEPMODE != _mode) {}
|
||||
|
||||
sam0_cortexm_sleep(0);
|
||||
}
|
||||
|
@ -26,34 +26,32 @@
|
||||
|
||||
void pm_set(unsigned mode)
|
||||
{
|
||||
if (mode < PM_NUM_MODES) {
|
||||
uint32_t _mode;
|
||||
uint32_t _mode;
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
DEBUG_PUTS("pm_set(): setting BACKUP mode.");
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_BACKUP;
|
||||
break;
|
||||
case 1:
|
||||
DEBUG_PUTS("pm_set(): setting STANDBY mode.");
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_STANDBY;
|
||||
break;
|
||||
default: /* Falls through */
|
||||
case 2:
|
||||
DEBUG_PUTS("pm_set(): setting IDLE mode.");
|
||||
switch (mode) {
|
||||
case 0:
|
||||
DEBUG_PUTS("pm_set(): setting BACKUP mode.");
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_BACKUP;
|
||||
break;
|
||||
case 1:
|
||||
DEBUG_PUTS("pm_set(): setting STANDBY mode.");
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_STANDBY;
|
||||
break;
|
||||
default: /* Falls through */
|
||||
case 2:
|
||||
DEBUG_PUTS("pm_set(): setting IDLE mode.");
|
||||
#if !defined(PM_SLEEPCFG_SLEEPMODE_IDLE2)
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE;
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE;
|
||||
#else
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE2;
|
||||
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE2;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
/* write sleep configuration */
|
||||
PM->SLEEPCFG.bit.SLEEPMODE = _mode;
|
||||
/* make sure value has been set */
|
||||
while (PM->SLEEPCFG.bit.SLEEPMODE != _mode) {}
|
||||
break;
|
||||
}
|
||||
|
||||
/* write sleep configuration */
|
||||
PM->SLEEPCFG.bit.SLEEPMODE = _mode;
|
||||
/* make sure value has been set */
|
||||
while (PM->SLEEPCFG.bit.SLEEPMODE != _mode) {}
|
||||
|
||||
sam0_cortexm_sleep(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user