1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/sam0_common: distribute PM_NUM_MODES among siblings

Also adapt the defines to the documentation

 - CPUs define up to 4 power modes (from zero, the lowest power mode,
   to PM_NUM_MODES-1, the highest)
 - >> there is an implicit extra idle mode (which has the number PM_NUM_MODES) <<

Previously on saml21 this would always generate pm_set(3) which is an illegal state.
Now pm_layered will correctly generate pm_set(2) for IDLE modes.

Idle power consumption dropped from 750µA to 368µA and wake-up from standby is also
possible. (Before it would just enter STANDBY again as the mode register was never
written with the illegal value.)
This commit is contained in:
Benjamin Valentin 2020-02-25 16:14:15 +01:00 committed by Benjamin Valentin
parent 744896b062
commit 5d123cbb22
5 changed files with 28 additions and 11 deletions

View File

@ -96,17 +96,6 @@ enum {
*/
#define GPIO_MODE(pr, ie, pe) (pr | (ie << 1) | (pe << 2))
/**
* @name Power mode configuration
* @{
*/
#ifdef CPU_SAML1X
#define PM_NUM_MODES (2)
#else
#define PM_NUM_MODES (3)
#endif
/** @} */
#ifndef DOXYGEN
/**
* @brief Override GPIO modes

View File

@ -28,6 +28,13 @@
extern "C" {
#endif
/**
* @name Power mode configuration
* @{
*/
#define PM_NUM_MODES (3)
/** @} */
/**
* @brief Override the default initial PM blocker
* @todo Idle modes are enabled by default, deep sleep mode blocked

View File

@ -43,6 +43,13 @@ extern "C" {
*/
#define SAM0_DPLL_FREQ_MAX_HZ (200000000U)
/**
* @name Power mode configuration
* @{
*/
#define PM_NUM_MODES (3)
/** @} */
/**
* @name SAMD5x GCLK definitions
* @{

View File

@ -26,6 +26,13 @@
extern "C" {
#endif
/**
* @name Power mode configuration
* @{
*/
#define PM_NUM_MODES (1)
/** @} */
/**
* @brief Override the default initial PM blocker
* @todo Idle modes are enabled by default, deep sleep mode blocked

View File

@ -31,6 +31,13 @@ extern "C" {
*/
#define CPU_BACKUP_RAM_NOT_RETAINED (1)
/**
* @name Power mode configuration
* @{
*/
#define PM_NUM_MODES (2)
/** @} */
/**
* @name SAML21 GCLK definitions
* @{