BriscoeTech / Arduino-FreeRTOS-SAMD21

A port of FreeRTOS that runs on Arduino Samd21 boards
63 stars 19 forks source link

How to use sleep modes? #37

Open eren-rudy opened 2 weeks ago

eren-rudy commented 2 weeks ago

I tried using the Arduino Low Power library to configure an interrupt by calling LowPower.sleep() in the idle task void loop(). I suppose it isn't surprising, given the warning "No rtos blocking functions allowed!" in the example code, that this was unsuccessful.

So, I went to the FreeRTOS documentation (Low power support) to learn more about using low power states. I looked in the FreeRTOSConfig.h file to see if configUSE_TICKLESS_IDLE was set, but didn't find it. I also searched all the source files for an implementation of portSUPPRESS_TICKS_AND_SLEEP() and couldn't find anything.

The RTOS documentation (found at the link above) provides a sample implementation of portSUPPRESS_TICKS_AND_SLEEP(), in the case that the port you are using doesn't provide it. However, I am not sure how I would implement a function such as prvStopTickInterruptTimer() (which is called in the sample implementation of portSUPPRESS_TICKS_AND_SLEEP() because as far as I can tell the timer used by the RTOS Kernel is not exposed the programmer. Apologies if I am missing something obvious, I am new to FreeRTOS. Thanks!