FastLED 3.10.6
Loading...
Searching...
No Matches
ColorProfile.ino
Go to the documentation of this file.
1// FL_AGENT_ALLOW_NEW_EXAMPLE -- the first example of the colour-profile API
2// (ChannelOptions::setColorProfile), which had none. It is also the probe
3// P9 (#4043) measures the colour pipeline's flash/RAM budget with: build it
4// with and without -DFASTLED_EXAMPLE_NO_COLOR_PROFILE=1 and the difference is
5// what binding a profile costs on that board.
6//
7// @filter: (memory is large)
8//
9// The Channels API alone is beyond an Uno's 32 KB. On small boards the colour
10// pipeline is compiled out entirely (FL_COLOR_PROFILE_RUNTIME, and the
11// shared-ownership parts under FL_COLOR_PIPELINE_SHARED), so they pay nothing
12// for it.
13//
14// What binding a profile does: every pixel goes through a streaming colour
15// pipeline -- decode the source (linear sRGB here), map it into the strip's
16// own gamut, solve the drives each emitter needs -- so a colour written as
17// CRGB lands at the same colour on the strip, rather than at whatever the
18// strip's primaries happen to make of those numbers. Brightness is applied
19// inside the pipeline as a linear flux scale, so dimming does not shift hue.
20
21#include <FastLED.h>
22#include "fl/channels/channel.h"
23#include "fl/channels/config.h"
25
26#define NUM_LEDS 60
27#ifndef PIN_DATA
28#define PIN_DATA FL_PIN_CLOCKLESS_1 // a sketch or build flag still overrides
29#endif
30
32
33void setup() {
35#if !defined(FASTLED_EXAMPLE_NO_COLOR_PROFILE)
36 // A profile describes the strip: its primaries' chromaticities and
37 // relative luminances. `WS2812B` is a placeholder until measured profiles
38 // land (P10); pass your own `fl::EmitterProfile` for a characterised part.
40#endif
41 // Dither. Binding a profile switches it off; asking for it again selects
42 // the pipeline's own temporal dither, for smoother fades at low
43 // brightness. Without a profile this is the default legacy dither, so
44 // both budget builds (see docs/color-pipeline-budgets.md) set it alike.
49 FastLED.setBrightness(64);
50}
51
52void loop() {
53 // A slow hue sweep: with a profile bound, equal steps here are equal
54 // steps of colour on the strip.
55 const uint8_t hue = static_cast<uint8_t>(millis() / 32);
57 FastLED.show();
58 delay(16);
59}
CRGB leds[1]
#define NUM_LEDS
#define PIN_DATA
void setup()
void loop()
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
uint8_t hue
Definition advanced.h:94
ESP32-P4 Parallel IO (PARLIO) LED channel.
Shared colorimetric primitives reusable by the RGBW and (future) RGB colorimetric paths (issue #3255)...
void fill_rainbow(CRGB *targetArray, int numToFill, fl::u8 initialhue, fl::u8 deltahue=5) FL_NO_EXCEPT
Fill a range of LEDs with a rainbow of colors.
Definition fill.cpp.hpp:29
#define BINARY_DITHER
Enable dithering using binary dithering (only option)
Definition dither_mode.h:16
constexpr EOrder GRB
Definition eorder.h:19
fl::CRGB CRGB
Definition crgb.h:25
static constexpr EmitterProfile WS2812B
constexpr ClocklessChipset makeClockless(int pin) FL_NO_EXCEPT
Build a ClocklessChipset from a compile-time TIMING trait.
Definition config.h:95
unsigned char uint8_t
Definition stdint.h:208
Configuration for a single LED channel.
Definition config.h:167
bool setColorProfile(const EmitterProfile &profile) FL_NO_EXCEPT
Definition options.h:99
fl::u8 mDitherMode
Definition options.h:88
Optional channel configuration parameters All fields have sensible defaults and can be overridden as ...
Definition options.h:85