FastLED 3.10.6
Loading...
Searching...
No Matches
task.h File Reference
#include "fl/stl/functional.h"
#include "fl/stl/string.h"
#include "fl/system/trace.h"
#include "fl/task/promise.h"
#include "fl/stl/shared_ptr.h"
#include "fl/stl/cstddef.h"
#include "fl/stl/noexcept.h"
+ Include dependency graph for task.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fl::task::CoroutineConfig
 Function and platform tuning for an OS-level coroutine task. More...
 
class  fl::task::Handle
 Task Handle with fluent API (was class fl::task, renamed to avoid namespace collision) More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 
namespace  fl::task
 

Enumerations

enum class  fl::task::TaskType {
  fl::task::kEveryMs , fl::task::kAtFramerate , fl::task::kBeforeFrame , fl::task::kAfterFrame ,
  fl::task::kCoroutine
}
 Identifies how a scheduled task is triggered. More...
 

Functions

Handle fl::task::after_frame () FL_NO_EXCEPT
 Creates a task that runs after every FastLED frame until canceled.
 
Handle fl::task::after_frame (const TracePoint &trace) FL_NO_EXCEPT
 Creates a traced task that runs after every FastLED frame until canceled.
 
Handle fl::task::after_frame (function< void()> on_then) FL_NO_EXCEPT
 Creates an after-frame task, running until canceled, with its success callback already configured.
 
Handle fl::task::after_frame (function< void()> on_then, const TracePoint &trace) FL_NO_EXCEPT
 Creates a traced after-frame task, running until canceled, with its success callback already configured.
 
Handle fl::task::at_framerate (int fps) FL_NO_EXCEPT
 Creates a task that runs at a fixed frame rate.
 
Handle fl::task::at_framerate (int fps, const TracePoint &trace) FL_NO_EXCEPT
 Creates a traced task that runs at a fixed frame rate.
 
Handle fl::task::before_frame () FL_NO_EXCEPT
 Frame tasks recur: every overload below schedules a task that runs once per FastLED frame and keeps doing so until Handle::cancel() is called on it, so keep the returned handle whenever the task will need to be canceled.
 
Handle fl::task::before_frame (const TracePoint &trace) FL_NO_EXCEPT
 Creates a traced task that runs before every FastLED frame until canceled.
 
Handle fl::task::coroutine (const CoroutineConfig &config) FL_NO_EXCEPT
 Creates and starts an OS-level coroutine task.
 
Handle fl::task::every_ms (int interval_ms) FL_NO_EXCEPT
 Creates a task that runs at a fixed millisecond interval.
 
Handle fl::task::every_ms (int interval_ms, const TracePoint &trace) FL_NO_EXCEPT
 Creates a traced task that runs at a fixed millisecond interval.
 
void fl::task::exit_current () FL_NO_EXCEPT
 Terminates the currently executing coroutine.
 

Class Documentation

◆ fl::task::CoroutineConfig

struct fl::task::CoroutineConfig
+ Collaboration diagram for fl::task::CoroutineConfig:
Class Members
optional< int > core_id Optional CPU core affinity, unset by default (no affinity).

Only ESP32 honors it; a value outside [0, FL_CPU_CORES) is silently downgraded to no affinity, and single-core or non-RTOS platforms ignore the field.

function< void()> func Function executed by the coroutine, copied at creation time.

An empty function is legal: the coroutine starts, does nothing, and exits.

string name = "task" Diagnostic name reported by the platform. Defaults to "task".
u8 priority = 5 Platform task priority relative to the platform idle priority, default 5.

On ESP32 the FreeRTOS priority becomes tskIDLE_PRIORITY + priority. FastLED does not clamp this against the platform maximum.

size_t stack_size = 4096 Requested stack size in bytes, default 4096.

A platform may raise a smaller request to its own floor (ESP32 clamps up to 2048) and platforms that emulate coroutines may ignore the field entirely.

optional< TracePoint > trace Optional location where the task was created, reported by Handle::trace_label().

Unset by default, in which case the label is empty.