ESPHome
2026.4.0
Loading...
Searching...
No Matches
esphome
core
main_task.h
Go to the documentation of this file.
1
#pragma once
2
5
6
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
7
8
#ifdef USE_ESP32
9
#include <freertos/FreeRTOS.h>
10
#include <freertos/task.h>
11
#else
12
#include <FreeRTOS.h>
13
#include <task.h>
14
#endif
15
16
#ifdef __cplusplus
17
extern
"C"
{
18
#endif
19
20
extern
TaskHandle_t
esphome_main_task_handle
;
21
23
static
inline
void
esphome_main_task_notify() {
24
TaskHandle_t task =
esphome_main_task_handle
;
25
if
(task != NULL) {
26
xTaskNotifyGive(task);
27
}
28
}
29
31
static
inline
void
esphome_main_task_notify_from_isr(BaseType_t *px_higher_priority_task_woken) {
32
TaskHandle_t task =
esphome_main_task_handle
;
33
if
(task != NULL) {
34
vTaskNotifyGiveFromISR(task, px_higher_priority_task_woken);
35
}
36
}
37
38
#ifdef USE_ESP32
40
static
inline
void
esphome_main_task_notify_any_context() {
41
if
(xPortInIsrContext()) {
42
int
px_higher_priority_task_woken = 0;
43
esphome_main_task_notify_from_isr(&px_higher_priority_task_woken);
44
portYIELD_FROM_ISR(px_higher_priority_task_woken);
45
}
else
{
46
esphome_main_task_notify();
47
}
48
}
49
#endif
50
51
#ifdef __cplusplus
52
}
53
#endif
54
55
#endif
// USE_ESP32 || USE_LIBRETINY
esphome_main_task_handle
TaskHandle_t esphome_main_task_handle
Main loop task handle and wake helpers — shared between wake.h (C++) and lwip_fast_select....
Definition
main_task.c:4
Generated by
1.12.0