5#ifndef ELEC_C7222_UTILS_FREERTOS_TASK_HPP
6#define ELEC_C7222_UTILS_FREERTOS_TASK_HPP
41 static constexpr std::uint32_t
kInfinite = std::numeric_limits<std::uint32_t>::max();
54 std::uint32_t stack_depth_words,
55 std::uint32_t priority,
57 void* task_arg =
nullptr);
64 std::uint32_t stack_depth_words,
65 std::uint32_t priority,
67 void* task_arg =
nullptr);
77 bool Delete(std::uint32_t ticks_to_wait = 0);
98 static void Delay(std::uint32_t ticks);
106 static std::uint32_t
MsToTicks(std::uint32_t milliseconds);
118 void* handle_{
nullptr};
120 void* task_arg_{
nullptr};
121 std::uint32_t priority_{0};
Ownership-based wrapper for a task/thread execution object.
Definition freertos_task.hpp:36
void RunTaskBody()
Internal bridge used by platform task-entry trampolines.
static std::uint32_t GetTickCount()
bool Delete(std::uint32_t ticks_to_wait=0)
Delete the task.
static void Delay(std::uint32_t ticks)
Delay current task for a number of ticks.
static constexpr std::uint32_t kInfinite
Sentinel tick value representing an infinite wait.
Definition freertos_task.hpp:41
std::uint32_t GetPriority() const
Get current task priority.
static std::uint32_t MsToTicks(std::uint32_t milliseconds)
Convert milliseconds to scheduler ticks.
FreeRtosTask()=default
Construct an uninitialized task wrapper.
static void StartScheduler()
Start the scheduler.
static std::uint32_t IdlePriority()
FreeRtosTask(const char *name, std::uint32_t stack_depth_words, std::uint32_t priority, TaskFunction task_function, void *task_arg=nullptr)
Construct and initialize a task.
static void Yield()
Yield current task.
bool SetPriority(std::uint32_t priority)
Set task priority.
bool Initialize(const char *name, std::uint32_t stack_depth_words, std::uint32_t priority, TaskFunction task_function, void *task_arg=nullptr)
Initialize (or re-initialize) a task.
bool Suspend()
Suspend the task.
bool ResumeFromISR()
Resume the task from ISR context.
~FreeRtosTask()
Delete owned task resource if initialized.
bool Resume()
Resume the task from task context.
std::function< void(void *)> TaskFunction
Task callable signature.
Definition freertos_task.hpp:39
Disable both copy and move operations.
Definition non_copyable.hpp:75
C7222 course abstractions namespace.
Definition ble.hpp:20
Base classes to control copy/move semantics.