Skip to content
Snippets Groups Projects
Commit 374ca0bb authored by schneider's avatar schneider
Browse files

feat(sleep): Allow the interrupt module to break epic_sleep

parent c4fe452c
Branches
Tags
1 merge request!480Pycardium: Use sleep API call while sleeping
......@@ -210,5 +210,7 @@ void sleep_deepsleep(void)
void epic_sleep(uint32_t ms)
{
vTaskDelay(pdMS_TO_TICKS(ms));
/* Allow the interrupt module to break us out of a call to
* epic_sleep() */
ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(ms));
}
......@@ -2,6 +2,7 @@
#include "os/core.h"
#include "epicardium.h"
#include "api/interrupt-sender.h"
#include "user_core/user_core.h"
#include <assert.h>
struct interrupt_priv {
......@@ -45,6 +46,10 @@ void interrupt_trigger_sync(api_int_id_t id)
;
api_interrupt_trigger(id);
/* Break the dispatcher task out of a potential call
* to epic_sleep() */
xTaskNotifyGive(dispatcher_task_id);
out:
mutex_unlock(&interrupt_mutex);
}
......@@ -171,6 +176,10 @@ void vInterruptsTask(void *pvParameters)
interrupt_data.has_pending = false;
} else if (interrupt_data.int_enabled[current_irq]) {
api_interrupt_trigger(current_irq);
/* Break the dispatcher task out of a potential call
* to epic_sleep() */
xTaskNotifyGive(dispatcher_task_id);
}
mutex_unlock(&interrupt_mutex);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment