Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 9 months ago.
Why not use deepsleep() in this example?
Why not use deepsleep() in this example?
Question relating to:

2 Answers
9 years, 9 months ago.
Because deepsleep() is deprecated. The regular sleep() is now supposed to determine the best sleep mode to use based on what peripherals are in use. See here for more details.
Does this deprecation only relate to Silicon Labs platforms? Other platforms are not affected?
posted by 09 Jun 2015Do note the 'eventually'. This is in other places called soon(tm) ( http://nl.urbandictionary.com/define.php?term=soon+(tm) ). And while for some targets that might be the case, I expect for enough others the correct answer will be: "Not before hell freezes over". (Note, just based on my expectations, I might also be proven wrong).
posted by 09 Jun 2015I feel like if the mbed devs want us to use these new APIs, they had better start back-porting them to the older platforms soon. Otherwise, everyone will continue to use the old APIs for compatibility reasons. Case in point: device libraries. Are you going to write an asynchronous library that works on a few platforms, or a synchronous library that works on all of the platforms?
posted by 09 Jun 2015Note that deepsleep() will still force deep sleep, even on Silicon Labs platforms. However, forcing deep sleep will also corrupt any asynchronous transfers going on, so you cannot use it with the new asynch APIs.
So for compatibility's sake, EFM32 platforms should still support all older code. But, if you want to take advantage of the low power features, I strongly encourage you to move to asynch I/O and the unified sleep().
posted by 10 Jun 20159 years, 9 months ago.
Neil provided an answer above that sleep() became the entry point to the sleep modes. I'll add some more comments to it.
It's confusing to have sleep() and deepsleep(), a lot of ppl ask what's the difference, which mode does it go into for my platform? With unified sleep answer is - to the lowest possible mode it can get based on what's running.
Silabs sleep() is tight to new asynch API (see blockSleepMode unblockSleepMode in the silabs HAL).
@Jeremy, yes other platforms are not affected yet.
I don't have enough hours per day to port any other platform, and obviously this is not one man job.