FastLED 3.10.8
Loading...
Searching...
No Matches
pipeline_binding.h
Go to the documentation of this file.
1#pragma once
2
3// From a channel's colour-profile binding to a running pipeline (P6, #4040).
4//
5// `ColorProfileBinding` has carried a source profile, an emitter profile and
6// a gamut policy for a while, and nothing read them: the binding's
7// acceptance was tracked, but no pixel ever went through it. This is the
8// adapter that turns one into a `StreamingPipelineQ16`.
9//
10// It lives here rather than in fl/gfx because the dependency runs that way
11// round -- channels already include gfx headers, and gfx must not learn
12// about channels.
13
16#include "fl/channels/config.h"
17#include "fl/channels/options.h" // FL_COLOR_PIPELINE_SHARED
21#include "fl/stl/vector.h"
22#include "fl/gfx/eorder.h"
23#include "fl/gfx/pipeline.h"
24#include "fl/gfx/rgbw.h"
25#include "fl/gfx/rgbww.h"
26#include "pixel_controller.h"
27#include "fl/stl/noexcept.h"
28
29namespace fl {
30
31class CLEDController;
32class Channel;
33
34#if FL_COLOR_PIPELINE_SHARED
36#endif
37
46
68constexpr fl::size kColorPipelineIteratorStorage = sizeof(PixelIterator);
69
70#if FL_COLOR_PIPELINE_SHARED
74struct ManagedPowerHistogram {
75 static constexpr u8 kBins = 64;
76 u32 counts[5][kBins] = {};
77 u32 pixels = 0;
78 u8 emitters = 3;
79};
80#endif
81
86
93 PixelIterator* (*makeIterator)(void* source_storage,
94 void* iterator_storage,
96 EOrder order,
97 ColorPipelineFrameRef pipeline,
98 const Rgbw& rgbw, Rgbww rgbww,
99 u8 dither_phase, u8 brightness);
100
102 void (*destroyIterator)(void* source_storage, void* iterator_storage);
103
113
128#if FL_COLOR_PIPELINE_SHARED
129 using PowerEstimator = u32 (*)(span<const u8> interleaved_codes,
130 u8 emitter_count);
131 u32 (*unscaledPowerMilliwatts)(const StreamingPipelineQ16& pipeline,
132 span<const CRGB> leds, u8 emitter_count,
133 PowerEstimator estimate);
134#endif
135
146 SpiChipset chip, const Channel& controller);
147};
148
149#if FL_COLOR_PIPELINE_SHARED
153struct PowerFrameHooks {
154 void (*buildPowerHistogram)(const StreamingPipelineQ16& pipeline,
155 span<const CRGB> leds, u8 emitter_count,
156 ManagedPowerHistogram* out);
157 u64 (*histogramPowerNumerator)(const StreamingPipelineQ16& pipeline,
158 const ManagedPowerHistogram& histogram,
159 FluxScalar flux, PowerCodecPolicy codec,
160 const u8 (&weights)[5],
161 u8 (*electricalMap)(u8 code));
162 bool frameFluxActive;
163 u32 frameFluxQ16;
164};
165
166PowerFrameHooks& powerFrameHooks() FL_NO_EXCEPT;
167#endif
168
171ColorPipelineHooks& colorPipelineHooks() FL_NO_EXCEPT;
172
178
179} // namespace fl
CRGB leds[1]
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
CLEDController * controller
Rgbw rgbw
LED channel for parallel output, pretty much a CPixelLEDController but with timing and pin informatio...
Definition channel.h:60
Runs processPixelQ16 over a PixelController's pixels as they are read.
A linear flux scalar in s16.16.
Definition flux_scalar.h:21
Non-templated low level pixel data writing class.
Functions for red, green, blue, white (RGBW) output.
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
void installColorPipelineHooks() FL_NO_EXCEPT
Point the hooks at the real implementations.
constexpr fl::size kColorPipelineSourceStorage
The two things Channel needs from the colour pipeline, reached through pointers rather than by name.
fl::variant< ClocklessChipset, SpiChipsetConfig > ChipsetVariant
Definition config.h:157
ColorPipelineHooks & colorPipelineHooks() FL_NO_EXCEPT
The installed hooks.
constexpr fl::size kColorPipelineIteratorStorage
bool buildPipelineForBinding(const ColorProfileBinding &binding, StreamingPipelineQ16 *out) FL_NO_EXCEPT
Build the streaming pipeline a binding describes.
EOrder
RGB color channel orderings, used when instantiating controllers to determine what order the controll...
Definition eorder.h:15
StreamingPipelineQ16 & ColorPipelineFrameRef
fl::u64 u64
Definition s16x16x4.h:221
SpiChipset
LED chipsets with SPI interface (clocked protocols) Modern type-safe enum class - prefer this for new...
Base definition for an LED controller.
bool(* build)(const ColorProfileBinding &, const ChannelOptions &, const ChipsetVariant &, StreamingPipelineQ16 *)
Derives a pipeline from a binding. Null until installed.
void(* destroyIterator)(void *source_storage, void *iterator_storage)
Destroys what makeIterator built. Null until installed.
bool(* encodeManagedSpi)(PixelIterator &pixels, vector_psram< u8 > *out, SpiChipset chip, const Channel &controller)
Unscaled (full-brightness) power demand of leds as the pipeline will drive them, in mW,...
void(* notifyProfileClearedByLegacy)()
Fires ChannelEvents::onColorProfileWarning(ProfileClearedByLegacy).
Everything the per-pixel path needs, derived once when a profile binds.
Definition pipeline.h:73
Low level pixel data writing class.
5-channel RGB + warm-W + cool-W (RGBWW / RGBCCT) configuration types (issue #2558,...
#define FL_NO_EXCEPT
SPI LED chipset enumeration.
Pixel controller class.
Optional channel configuration parameters All fields have sensible defaults and can be overridden as ...
Definition options.h:92
Immutable profile binding carried by a channel.