[riot-notifications] [RIOT-OS/RIOT] cpu/sam0: add support for SAMD5x/SAME5x (#11305)

benpicco notifications at github.com
Wed Apr 10 18:51:36 CEST 2019


benpicco commented on this pull request.



> +                DEBUG("pm_set(): setting IDLE1 mode.\n");
+                _mode = PM_SLEEPCFG_SLEEPMODE_IDLE1;
+                break;
+            case 3:
+                DEBUG("pm_set(): setting IDLE0 mode.\n");
+                _mode = PM_SLEEPCFG_SLEEPMODE_IDLE0;
+                break;
+        }
+
+        /* write sleep configuration */
+        PM->SLEEPCFG.bit.SLEEPMODE = _mode;
+        /* make sure value has been set */
+        while (PM->SLEEPCFG.bit.SLEEPMODE != _mode) {}
+    }
+
+    cortexm_sleep(mode);

Actually all modes but 0 do a light sleep - but just looking at the power consumption, `PM_SLEEPCFG_SLEEPMODE_IDLE2` is the default anyway if only `cortexm_sleep()` is called.

This MCU also supports three deep sleep states (STANDBY, HIBERNATE & BACKUP) but since pm_layered only supports 4 sleep modes (and on all other sam0 boards modes 1-3 are used for light sleep / idle and I wanted to keep the semantics the same), only the deepest one is exposed. The RTC still can wake the MCU in this mode which is good enough for me.

Since all the sam0s expose different sets of sleep states I think the pain of light code duplication is still less than that that of a confusing mess of `#ifdefs` in a common version.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11305#discussion_r274060188
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190410/f04da008/attachment.html>


More information about the notifications mailing list