Skip to content

Commit

Permalink
esp32/mphalport: Add function to wake main from separate FreeRTOS task.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
  • Loading branch information
pi-anl authored and dpgeorge committed Nov 1, 2023
1 parent 95ce61d commit d8a2634
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ports/esp32/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions ports/esp32/mphalport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d8a2634

Please sign in to comment.