[riot-devel] How to properly use cortexm_sleep

Kees Bakker kees at sodaq.com
Sun May 26 17:39:26 CEST 2019


Hey

Is there anyone using cortexm_sleep for a real application? And if
yes, would you want to share how exactly that's done?

Let me say that I've never written a real application with RIOT, but
I would like to. One of the important requirements is that the app
must be in sleep (deep sleep) and only wake up to do some work.
And another requirement is to use the watchdog.

That said, I'm familiar with the following Arduino pseudo code.

     while (forever) {
         do stuff

         disable interrupts
         if !certain condition
             __WFI();
         enable interrupts
     }

That "certain condition" is mostly checking that no WDT or RTC interrupt
occurred before disabling the interrupts. These interrupts are handled
by ISR's and they set a flag. This is a fairly common thing to do, I think.

I don't see (or understand) how this can be achieved with RIOT-OS and
cortexm_sleep. It is essential to check the condition AFTER disabling the
interrupts.
-- 
Kees Bakker


More information about the devel mailing list