FastLED
3.9.15
Loading...
Searching...
No Matches
context.h
Go to the documentation of this file.
1
#pragma once
2
3
// Context: All shared state for animations, passed to free-function visualizers.
4
// Extracted from animartrix_detail.hpp
5
6
#include "crgb.h"
7
#include "
fl/stl/optional.h
"
8
#include "
fl/stl/span.h
"
9
#include "
fl/stl/unique_ptr.h
"
10
#include "
fl/stl/stdint.h
"
11
#include "
fl/stl/noexcept.h
"
12
13
namespace
fl
{
14
15
// Forward declarations
16
struct
Context
;
17
struct
Engine
;
18
19
// Callback for mapping (x,y) to a 1D LED index
20
using
XYMapCallback
= fl::u16 (*)(fl::u16
x
, fl::u16
y
,
void
*userData);
21
22
// Context: All shared state for animations, passed to free-function visualizers.
23
// Internally wraps an Engine to reuse existing logic.
24
struct
Context
{
25
// Grid dimensions
26
int
num_x
= 0;
27
int
num_y
= 0;
28
29
// Output target
30
fl::span<CRGB>
leds
;
31
XYMapCallback
xyMapFn
=
nullptr
;
32
void
*
xyMapUserData
=
nullptr
;
33
34
// Time
35
fl::optional<fl::u32>
currentTime
;
36
37
// Internal engine (reuses original implementation for bit-identical output)
38
fl::unique_ptr<Engine>
mEngine
;
39
40
Context
()
FL_NOEXCEPT
= default;
41
~
Context
()
FL_NOEXCEPT
;
42
Context
(const
Context
&)
FL_NOEXCEPT
= delete;
43
Context
&operator=(const
Context
&)
FL_NOEXCEPT
= delete;
44
};
45
46
}
// namespace fl
fl::span
Definition
span.h:385
fl::unique_ptr
Definition
unique_ptr.h:36
fl::x
x
Definition
transposition.cpp.hpp:24
fl::y
y
Definition
transposition.cpp.hpp:23
fl::optional
Optional< T > optional
Definition
optional.h:16
fl::XYMapCallback
fl::u16(*)(fl::u16 x, fl::u16 y, void *userData) XYMapCallback
Definition
context.h:20
fl
Base definition for an LED controller.
Definition
crgb.hpp:179
noexcept.h
optional.h
FL_NOEXCEPT
#define FL_NOEXCEPT
span.h
stdint.h
fl::Context::currentTime
fl::optional< fl::u32 > currentTime
Definition
context.h:35
fl::Context::xyMapFn
XYMapCallback xyMapFn
Definition
context.h:31
fl::Context::mEngine
fl::unique_ptr< Engine > mEngine
Definition
context.h:38
fl::Context::xyMapUserData
void * xyMapUserData
Definition
context.h:32
fl::Context::Context
Context() FL_NOEXCEPT=default
fl::Context::num_y
int num_y
Definition
context.h:27
fl::Context::num_x
int num_x
Definition
context.h:26
fl::Context::leds
fl::span< CRGB > leds
Definition
context.h:30
fl::Context
Definition
context.h:24
fl::Engine
Definition
engine.h:19
unique_ptr.h
fl
fx
2d
animartrix_detail
context.h
Generated on Tue Jun 16 2026 00:06:59 for FastLED by
1.13.2