FastLED 3.10.6
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; // fl/channels/cled_controller.h; only a reference is named here
32
41
63constexpr fl::size kColorPipelineIteratorStorage = sizeof(PixelIterator);
64
65#if FL_COLOR_PIPELINE_SHARED
69struct ManagedPowerHistogram {
70 static constexpr u8 kBins = 64;
71 u32 counts[5][kBins] = {};
72 u32 pixels = 0;
73 u8 emitters = 3;
74};
75#endif
76
81
88 PixelIterator* (*makeIterator)(void* source_storage,
89 void* iterator_storage,
91 EOrder order,
92 ColorPipelineFrameRef pipeline,
93 const Rgbw& rgbw, Rgbww rgbww,
94 u8 dither_phase, u8 brightness);
95
97 void (*destroyIterator)(void* source_storage, void* iterator_storage);
98
108
123#if FL_COLOR_PIPELINE_SHARED
124 using PowerEstimator = u32 (*)(span<const u8> interleaved_codes,
125 u8 emitter_count);
126 u32 (*unscaledPowerMilliwatts)(const StreamingPipelineQ16& pipeline,
127 span<const CRGB> leds, u8 emitter_count,
128 PowerEstimator estimate);
129#endif
130
142};
143
144#if FL_COLOR_PIPELINE_SHARED
148struct PowerFrameHooks {
149 void (*buildPowerHistogram)(const StreamingPipelineQ16& pipeline,
150 span<const CRGB> leds, u8 emitter_count,
151 ManagedPowerHistogram* out);
152 u64 (*histogramPowerNumerator)(const StreamingPipelineQ16& pipeline,
153 const ManagedPowerHistogram& histogram,
154 FluxScalar flux, PowerCodecPolicy codec,
155 const u8 (&weights)[5],
156 u8 (*electricalMap)(u8 code));
157 bool frameFluxActive;
158 u32 frameFluxQ16;
159};
160
161PowerFrameHooks& powerFrameHooks() FL_NO_EXCEPT;
162#endif
163
166ColorPipelineHooks& colorPipelineHooks() FL_NO_EXCEPT;
167
173
174} // namespace fl
CRGB leds[1]
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
CLEDController * controller
Rgbw rgbw
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
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
InputGamut g FL_NO_EXCEPT
Definition rgbw.h:121
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:13
StreamingPipelineQ16 & ColorPipelineFrameRef
SpiChipset
LED chipsets with SPI interface (clocked protocols) Modern type-safe enum class - prefer this for new...
Base definition for an LED controller.
Definition crgb.hpp:179
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.
void(* notifyProfileClearedByLegacy)()
Fires ChannelEvents::onColorProfileWarning(ProfileClearedByLegacy).
bool(* encodeManagedSpi)(PixelIterator &pixels, vector_psram< u8 > *out, SpiChipset chip, const CLEDController &controller)
Unscaled (full-brightness) power demand of leds as the pipeline will drive them, in mW,...
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.
fl::u64 u64
Definition stdint.h:220
Pixel controller class.
Optional channel configuration parameters All fields have sensible defaults and can be overridden as ...
Definition options.h:85
Immutable profile binding carried by a channel.
Per-strip RGBWW configuration.
Definition rgbww.h:60