Skip to content

Improve default yield() #272

@mikaelpatel

Description

@mikaelpatel

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions