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
13namespace fl {
14
15// Forward declarations
16struct Context;
17struct Engine;
18
19// Callback for mapping (x,y) to a 1D LED index
20using 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.
24struct Context {
25 // Grid dimensions
26 int num_x = 0;
27 int num_y = 0;
28
29 // Output target
32 void *xyMapUserData = nullptr;
33
34 // Time
36
37 // Internal engine (reuses original implementation for bit-identical output)
39
40 Context() FL_NOEXCEPT = default;
42 Context(const Context &) FL_NOEXCEPT = delete;
43 Context &operator=(const Context &) FL_NOEXCEPT = delete;
44};
45
46} // namespace fl
Optional< T > optional
Definition optional.h:16
fl::u16(*)(fl::u16 x, fl::u16 y, void *userData) XYMapCallback
Definition context.h:20
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
fl::optional< fl::u32 > currentTime
Definition context.h:35
XYMapCallback xyMapFn
Definition context.h:31
fl::unique_ptr< Engine > mEngine
Definition context.h:38
void * xyMapUserData
Definition context.h:32
Context() FL_NOEXCEPT=default
int num_y
Definition context.h:27
int num_x
Definition context.h:26
fl::span< CRGB > leds
Definition context.h:30