4#ifndef TETL_FREERTOS_TASK_HPP
5#define TETL_FREERTOS_TASK_HPP
7#include <etl/version.hpp>
9#include <etl/cstddef.hpp>
10#include <etl/utility.hpp>
12#if defined(TETL_FREERTOS_USE_STUBS)
13 #include <etl/experimental/freertos/stubs.hpp>
34template <
etl::size_t Count>
51template <
typename TaskType>
54 static_cast<TaskType*>(task)->run();
58template <
typename TaskType>
61 char const*
const name,
64 TaskHandle_t*
const handle =
nullptr
67 xTaskCreate(rtos_task<TaskType>, name, stack,
static_cast<
void*>(&task), prio, handle);
auto sleep_for(etl::uint32_t ticks) -> void
Delay a task for a given number of ticks. The actual time that the task remains blocked depends on th...
Definition task.hpp:140
auto sleep_until(etl::uint32_t &prev, etl::uint32_t increment) -> void
Delay a task until a specified time. This function can be used by periodic tasks to ensure a constant...
Definition task.hpp:145
auto yield() -> void
Request a context switch to another task.
Definition task.hpp:135
auto delete_task(TaskHandle_t task) -> void
Delete a rtos task. If handle is nullptr, the current task will be deleted.
Definition task.hpp:72
auto rtos_task(void *task) -> void
Wrapper for an rtos task struct. Calls the run() member.
Definition task.hpp:52
auto create_task(TaskType &task, char const *const name, uint16_t stack, UBaseType_t prio=0, TaskHandle_t *const handle=nullptr) -> void
Create a rtos task. TaskType needs a void run() public method.
Definition task.hpp:59
auto start_scheduler() -> void
Start the RTOS, this function will never return and will schedule the tasks.
Definition task.hpp:79
Definition adjacent_find.hpp:9
Runs the task loop forever.
Definition task.hpp:26
auto operator()() const -> bool
Definition task.hpp:27
Runs the task loop 0 times.
Definition task.hpp:18
auto operator()() const -> bool
Definition task.hpp:19
Runs the task loop Count times.
Definition task.hpp:35
etl::size_t run_count
Definition task.hpp:36
auto operator()() -> bool
Definition task.hpp:38
auto vTaskStartScheduler() -> void
Definition stubs.hpp:57
auto vTaskDelete(TaskHandle_t xTask) -> void
Definition stubs.hpp:52
auto vTaskDelayUntil(TickType_t *const pxPreviousWakeTime, TickType_t const xTimeIncrement) -> void
Definition stubs.hpp:64
auto vTaskDelay(TickType_t const xTicksToDelay) -> void
Definition stubs.hpp:59