samd21 sleep

Hello,

I am working on a samd21 implementation of riot and when it comes to sleeping I see notes that say it is partially supported, like in peripheral_cpu_common.h: we block all modes per default, until PM is cleanly implemented.

My initial tests, after I comment out the weak pm_set_lowest bug show that the pm just runs at sleep mode 3 (I would like to achieve deep sleep), which I can probably hack if I understood better how it was implemented. There is the alternate cortex_sleep function in pm_set_lowest which appears to do a find job of deep sleeping the board forever, which isn’t quite my desired outcome.

In my application I have several threads that one something and then sleep, I am currently using xtimer_sleep.

Any feedback on how to accomplish deep sleep when all threads sleep is appreciated,

Thanks,

Dan