Commit bc4c4fb5 authored by schneider's avatar schneider
Browse files

feat(sleep): Tell the caller of epic_sleep() if an interrupt happened

parent 6204cdc5
......@@ -15,6 +15,7 @@
#include "mxc_pins.h"
#include <stdint.h>
#include <limits.h>
/* Most code is taken and adapted rom EvKitExamples/LP/main.c */
......@@ -208,9 +209,15 @@ void sleep_deepsleep(void)
MAX77650_setEN_SBB2(0b110);
}
void epic_sleep(uint32_t ms)
int epic_sleep(uint32_t ms)
{
/* Allow the interrupt module to break us out of a call to
* epic_sleep() */
ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(ms));
uint32_t count = ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(ms));
if (count == 0) {
return 0;
} else {
return INT_MAX;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment