12#if defined(FREERTOS) || defined(INC_FREERTOS_H) || defined(ESP_PLATFORM) || defined(ARDUINO_ARCH_ESP32)
13#include <freertos/FreeRTOS.h>
14#include <freertos/task.h>
15#define CORIUM_HAS_FREERTOS_INCLUDES 1
21#define portYIELD_FROM_ISR(x) ((void)(x))
29template <
typename EventSinkType>
43 template <
typename Event>
46 _sink.post(std::forward<Event>(event), priority);
47 if (pxHigherPriorityTaskWoken) {
48 *pxHigherPriorityTaskWoken =
pdTRUE;
53 template <
typename Event>
56 _sink.postHighPriority(std::forward<Event>(event));
57 if (pxHigherPriorityTaskWoken) {
58 *pxHigherPriorityTaskWoken =
pdTRUE;
65 if (xHigherPriorityTaskWoken ==
pdTRUE) {
71 [[nodiscard]]
constexpr EventSinkType&
sink() noexcept {
return _sink; }
72 [[nodiscard]]
constexpr const EventSinkType&
sink() const noexcept {
return _sink; }
75 EventSinkType _sink{};
79template <
typename EventSinkType>
long BaseType_t
Definition FreeRtos.hpp:18
#define portYIELD_FROM_ISR(x)
Definition FreeRtos.hpp:21
#define pdTRUE
Definition FreeRtos.hpp:19
Bounded and multi-tier priority MPSC queueing policies.
FreeRTOS-specialized ISR sink managing RTOS task context switches.
Definition FreeRtos.hpp:30
constexpr FreeRtosIsrSink() noexcept=default
constexpr EventSinkType & sink() noexcept
Access underlying sink handle.
Definition FreeRtos.hpp:71
void postFromIsr(Event &&event, BaseType_t *pxHigherPriorityTaskWoken=nullptr, EventPriority priority=EventPriority::Normal) noexcept
Post event from FreeRTOS ISR and track if context switch is needed.
Definition FreeRtos.hpp:44
void postHighPriorityFromIsr(Event &&event, BaseType_t *pxHigherPriorityTaskWoken=nullptr) noexcept
Post high priority event from FreeRTOS ISR and track context switch.
Definition FreeRtos.hpp:54
constexpr const EventSinkType & sink() const noexcept
Definition FreeRtos.hpp:72
static void yieldFromIsr(BaseType_t xHigherPriorityTaskWoken) noexcept
Yield to higher priority unblocked task if flag was set.
Definition FreeRtos.hpp:63
Definition CanAdapter.hpp:16
constexpr auto makeFreeRtosIsrSink(EventSinkType sink) noexcept
Helper function to construct FreeRtosIsrSink from an event sink handle.
Definition FreeRtos.hpp:80
EventPriority
Event priority levels for multi-priority queue policies.
Definition QueuePolicies.hpp:32
DefaultEvents Event
Alias for DefaultEvents.
Definition Events.hpp:65