diff options
author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2023-11-01 15:26:16 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-11-01 16:24:57 +1100 |
commit | d8a263435fc9e043dda9ba2f903c9348559f6582 (patch) | |
tree | 618e1288b858a3ea392aad3f30eee133551d234a | |
parent | 95ce61d0ad05af7b5ce258f1faa01a259dd1275a (diff) | |
download | micropython-d8a263435fc9e043dda9ba2f903c9348559f6582.tar.gz micropython-d8a263435fc9e043dda9ba2f903c9348559f6582.zip |
esp32/mphalport: Add function to wake main from separate FreeRTOS task.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
-rw-r--r-- | ports/esp32/mphalport.c | 7 | ||||
-rw-r--r-- | ports/esp32/mphalport.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/ports/esp32/mphalport.c b/ports/esp32/mphalport.c index 79ddcd4827..8e14bda595 100644 --- a/ports/esp32/mphalport.c +++ b/ports/esp32/mphalport.c @@ -214,7 +214,12 @@ uint64_t mp_hal_time_ns(void) { return ns; } -// Wake up the main task if it is sleeping +// Wake up the main task if it is sleeping. +void mp_hal_wake_main_task(void) { + xTaskNotifyGive(mp_main_task_handle); +} + +// Wake up the main task if it is sleeping, to be called from an ISR. void mp_hal_wake_main_task_from_isr(void) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; vTaskNotifyGiveFromISR(mp_main_task_handle, &xHigherPriorityTaskWoken); diff --git a/ports/esp32/mphalport.h b/ports/esp32/mphalport.h index 5e54c24bfe..d77e2dd0df 100644 --- a/ports/esp32/mphalport.h +++ b/ports/esp32/mphalport.h @@ -83,6 +83,7 @@ uint32_t mp_hal_get_cpu_freq(void); #define mp_hal_quiet_timing_exit(irq_state) MICROPY_END_ATOMIC_SECTION(irq_state) // Wake up the main task if it is sleeping +void mp_hal_wake_main_task(void); void mp_hal_wake_main_task_from_isr(void); // C-level pin HAL |