energia / msp432-core

MSP432 Core and Framework
14 stars 10 forks source link

Sleep() not defined in EMT #32

Closed robertinant closed 7 years ago

robertinant commented 8 years ago

From @measley on October 12, 2015 1:41

Sleep() does not appear to be defined in EMT (MSP432, CC3200)

I replaced sleep() with delay in blink.ino and got following error.

Blink.ino:32:13: error: 'sleep' was not declared in this scope

I understand the delay already has low power modes enabled, do we need to enable sleep() API for legacy or additional modes?

Copied from original issue: energia/Energia#742

robertinant commented 8 years ago

From @rei-vilo on December 14, 2015 18:56

@measley

With EMT, by default, idle mode, i.e. no task running = sleep.

robertinant commented 7 years ago

I could do a sleep macro that simply calls delay.

rei-vilo commented 7 years ago

I could do a sleep macro that simply calls delay.

Calling delay() would perform a yield.

robertinant commented 7 years ago

Thinking about this more, I am not going to provide sleep for any EMT targets. MSP430 will remain the only one that will have sleep.

rei-vilo commented 7 years ago

As an alternative, for a non-yielding sleep()

void nonYieldingSleep(uint32_t ms)
{
    uint32_t chrono = millis() + ms;
    while (millis() < chronology);
}