-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Should the default yield() function implement a low power mode?
Currently yield() is an empty function and delay() will busy wait for the delay period. To help designers the default function could use the power management functions available and instead use a sleep mode and wait for the next interrupt.
A typical implementation may be found in Cosa:
default_yield() https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/main.cpp#L154
Power::sleep() https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Power.cpp#L30
The Arduino core:
yield() https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/hooks.c#L31
delay() https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring.c#L106
Cheers!