FastLED 3.9.15
Loading...
Searching...
No Matches
fl Directory Reference
+ Directory dependency graph for fl:

Files

 algorithm.h
 
 align.h
 
 allocator.cpp
 
 allocator.h
 
 array.h
 
 assert.h
 
 async.cpp
 
 async.h
 Generic asynchronous task management for FastLED.
 
 atomic.h
 
 audio.cpp
 
 audio.h
 
 audio_reactive.cpp
 
 audio_reactive.h
 
 avr_disallowed.h
 
 bit_cast.h
 
 bitset.cpp
 
 bitset.h
 
 bitset_dynamic.h
 
 blur.cpp
 
 blur.h
 
 bytestream.h
 
 bytestreammemory.cpp
 
 bytestreammemory.h
 
 circular_buffer.h
 
 clamp.h
 
 clear.h
 
 colorutils.cpp
 Misc utility functions for palettes, blending, and more.
 
 colorutils.h
 Utility functions for color fill, palettes, blending, and more.
 
 colorutils_misc.h
 
 comparators.h
 
 compiler_control.h
 
 convert.h
 
 corkscrew.cpp
 
 corkscrew.h
 Corkscrew LED strip projection and rendering.
 
 crgb_hsv16.cpp
 HSV16-dependent methods for CRGB - only linked when HSV16 functionality is used.
 
 cstddef.h
 
 dbg.h
 
 deprecated.h
 
 deque.h
 
 dll.h
 FastLED dynamic library interface - lightweight header for external callers.
 
 downscale.cpp
 
 downscale.h
 
 draw_mode.h
 
 draw_visitor.h
 
 ease.cpp
 
 ease.h
 
 engine_events.cpp
 
 engine_events.h
 
 eorder.h
 Defines color channel ordering enumerations in the fl namespace.
 
 export.h
 Cross-platform export macros for FastLED dynamic library support.
 
 fetch.cpp
 
 fetch.h
 Unified HTTP fetch API for FastLED (cross-platform)
 
 fft.cpp
 
 fft.h
 
 fft_impl.cpp
 
 fft_impl.h
 
 file_system.cpp
 
 file_system.h
 
 fill.cpp
 
 fill.h
 
 five_bit_hd_gamma.h
 Declares functions for five-bit gamma correction.
 
 force_inline.h
 
 function.h
 
 function_list.h
 
 functional.h
 
 gamma.cpp
 
 gamma.h
 
 geometry.h
 
 gradient.cpp
 
 gradient.h
 
 grid.h
 
 has_define.h
 
 hash.h
 
 hash_map.h
 
 hash_map_lru.h
 
 hash_set.h
 
 hsv.h
 Defines the hue, saturation, and value (HSV) pixel struct.
 
 hsv16.cpp
 
 hsv16.h
 
 id_tracker.cpp
 
 id_tracker.h
 
 initializer_list.h
 
 inplacenew.h
 
 insert_result.h
 
 int.h
 
 io.cpp
 
 io.h
 
 istream.cpp
 
 istream.h
 
 json.cpp
 
 json.h
 FastLED's Elegant JSON Library: fl::Json
 
 leds.cpp
 
 leds.h
 
 line_simplification.cpp
 
 line_simplification.h
 
 lut.h
 
 map.h
 
 map_range.h
 
 math.h
 
 math_macros.h
 
 memfill.h
 
 memory.h
 
 move.h
 
 mutex.h
 
 namespace.h
 Implements the FastLED namespace macros.
 
 noise_woryley.cpp
 
 noise_woryley.h
 
 optional.h
 
 ostream.cpp
 
 ostream.h
 
 pair.h
 
 point.h
 
 printf.h
 
 priority_queue.h
 
 promise.h
 Promise-based fluent API for FastLED - standalone async primitives.
 
 promise_result.h
 Result type for promise operations with ok() semantics.
 
 ptr.cpp
 
 ptr.h
 
 ptr_impl.h
 
 queue.h
 
 random.cpp
 
 random.h
 
 range_access.h
 
 raster.h
 
 raster_sparse.cpp
 
 raster_sparse.h
 
 rbtree.h
 
 rectangular_draw_buffer.cpp
 
 rectangular_draw_buffer.h
 
 referent.cpp
 
 referent.h
 
 register.h
 
 rgbw.cpp
 Functions for red, green, blue, white (RGBW) output.
 
 rgbw.h
 Functions for red, green, blue, white (RGBW) output.
 
 scoped_array.h
 
 scoped_ptr.h
 
 screenmap.cpp
 
 screenmap.h
 
 set.h
 
 shared_ptr.h
 
 sin32.cpp
 
 sin32.h
 
 singleton.h
 
 sketch_macros.h
 
 slice.h
 
 span.h
 
 splat.cpp
 
 splat.h
 
 sstream.h
 
 stdint.h
 
 str.cpp
 
 str.h
 
 str_ui.cpp
 
 string.h
 
 strstream.cpp
 
 strstream.h
 
 stub_main.cpp
 
 supersample.h
 
 task.cpp
 
 task.h
 
 template_magic.h
 
 thread.h
 
 thread_local.h
 
 tile2x2.cpp
 
 tile2x2.h
 
 time.cpp
 
 time.h
 Universal timing functions for FastLED.
 
 time_alpha.cpp
 
 time_alpha.h
 
 trace.h
 
 transform.cpp
 
 transform.h
 
 traverse_grid.h
 
 tuple.h
 
 type_traits.cpp
 
 type_traits.h
 
 types.h
 
 ui.cpp
 
 ui.h
 
 ui_impl.h
 
 unique_ptr.h
 
 unordered_set.h
 
 unused.h
 
 upscale.cpp
 
 upscale.h
 
 utility.h
 
 variant.h
 
 vector.h
 
 virtual_if_not_avr.h
 
 warn.h
 
 wave_simulation.cpp
 
 wave_simulation.h
 
 wave_simulation_real.cpp
 
 wave_simulation_real.h
 
 weak_ptr.h
 
 xmap.cpp
 
 xmap.h
 
 xymap.cpp
 
 xymap.h
 
 xypath.cpp
 
 xypath.h
 
 xypath_impls.cpp
 
 xypath_impls.h
 
 xypath_renderer.cpp
 
 xypath_renderer.h
 

Detailed Description

This document introduces the FastLED core library housed under src/fl/, first by listing its headers, then by progressively expanding into an educational guide for two audiences:

FastLED avoids direct dependencies on the C++ standard library in embedded contexts and offers its own STL‑like building blocks in the fl:: namespace.

Table of Contents


Overview and Quick Start

What is fl::?

fl:: is FastLED’s cross‑platform foundation layer. It provides containers, algorithms, memory utilities, math, graphics primitives, async/concurrency, I/O, and platform shims designed to work consistently across embedded targets and host builds. It replaces common std:: facilities with equivalents tailored for embedded constraints and portability.

Key properties:

Goals and design constraints

Naming and idioms

Getting started: common building blocks

Include the top‑level header you need, or just include FastLED.h in sketches. When writing platform‑agnostic C++ within this repo, include the specific fl/ headers you use.

Common types to reach for:

Example: using containers, views, and ownership

#include "fl/vector.h"
#include "fl/span.h"
#include "fl/memory.h" // for fl::make_unique
void process(fl::span<const int> values) {
// Non-owning view over contiguous data
}
void example() {
data.push_back(1);
data.push_back(2);
data.push_back(3);
process(fl::span<const int>(data));
auto ptr = fl::make_unique<int>(42);
// Exclusive ownership; automatically freed when leaving scope
}
void push_back(const T &value)
Definition vector.h:552
fl::enable_if<!fl::is_array< T >::value, unique_ptr< T > >::type make_unique(Args &&... args)
Definition memory.h:42
Slice< T > span
Definition span.h:8
HeapVector< T, Allocator > vector
Definition vector.h:1214

Example: JSON with safe default access

#include "fl/json.h"
void json_example(const fl::string& jsonStr) {
fl::Json json = fl::Json::parse(jsonStr);
int brightness = json["config"]["brightness"] | 128; // default if missing
bool enabled = json["enabled"] | false;
}
UISlider brightness("Brightness", 128, 0, 255, 1)
static Json parse(const fl::string &txt)
Definition json.h:2126
FastLED's Elegant JSON Library: fl::Json

Header Groups (5 major areas)

1) STL‑like data structures and core utilities

Containers, views, algorithms, compile‑time utilities, memory/ownership, portability helpers.

Per‑header quick descriptions:

2) Graphics, geometry, and rendering

Rasterization, coordinate mappings, paths, grids, resampling, draw buffers, and related glue.

Per‑header quick descriptions:

3) Color, math, and signal processing

Color models, gradients, gamma, math helpers, random, noise, mapping, and basic DSP.

Per‑header quick descriptions:

4) Concurrency, async, and functional

Threads, synchronization, async primitives, eventing, and callable utilities.

Per‑header quick descriptions:

5) I/O, JSON, and text/formatting

Streams, strings, formatted output, bytestreams, filesystem, JSON.

Per‑header quick descriptions:

Comprehensive Module Breakdown

This section groups headers by domain, explains their role, and shows minimal usage snippets. Names shown are representative; see the header list above for the full inventory.

Containers and Views

Why: Embedded‑aware containers with predictable behavior across platforms. Prefer passing fl::span<T> to functions.

#include "fl/vector.h"
#include "fl/span.h"
size_t count_nonzero(fl::span<const uint8_t> bytes) {
size_t count = 0;
for (uint8_t b : bytes) { if (b != 0) { ++count; } }
return count;
}

Strings and Streams

Why: Consistent string/stream facilities without pulling in the standard streams.

#include "fl/string.h"
#include "fl/sstream.h"
fl::string greet(const fl::string& name) {
ss << "Hello, " << name << "!";
return ss.str();
}
const string & str() const
Definition strstream.h:51
StrStream sstream
Definition sstream.h:6

Memory and Ownership

Why: RAII ownership with explicit semantics. Prefer fl::make_shared<T>()/fl::make_unique<T>() patterns where available, or direct constructors provided by these headers.

#include "fl/shared_ptr.h"
struct Widget { int value; };
void ownership_example() {
fl::shared_ptr<Widget> w(new Widget{123});
auto w2 = w; // shared ownership
}

Functional Utilities

Why: Store callbacks and multicast them safely.

void on_event(int code) { /* ... */ }
void register_handlers() {
fl::function_list<void(int)> handlers;
handlers.add(on_event);
handlers(200); // invoke all
}

Concurrency and Async

Why: Lightweight foundations for parallel work or async orchestration where supported.

#include "fl/promise.h"
fl::promise<int> compute_async(); // returns a moveable wrapper around a future-like result
Promise class that provides fluent .then() and .catch_() semantics This is a lightweight wrapper arou...
Definition promise.h:72
Promise-based fluent API for FastLED - standalone async primitives.

Math, Random, and DSP

Why: Efficient numeric operations for LED effects, audio reactivity, and transforms.

#include "fl/gamma.h"
uint8_t apply_gamma(uint8_t v) {
return fl::gamma::correct8(v);
}

Geometry and Grids

Why: Building blocks for 2D/3D layouts and path operations.

Graphics, Rasterization, and Resampling

Why: Efficient frame manipulation for LED matrices and coordinate spaces.

#include "fl/downscale.h"
// Downscale a high‑res buffer to a target raster (API varies by adapter)

Graphics Deep Dive

This section explains how the major graphics utilities fit together and how to use them effectively for high‑quality, high‑performance rendering on LED strips, matrices, and complex shapes.

JSON Utilities

Why: Ergonomic, crash‑resistant access with defaulting operator (|). Prefer the fl::Json API for new code.

fl::Json cfg = fl::Json::parse("{\"enabled\":true}");
bool enabled = cfg["enabled"] | false;

I/O and Filesystem

Why: Cross‑platform text formatting, buffered I/O, and optional file access on host builds.

Algorithms and Utilities

Why: Familiar patterns with embedded‑appropriate implementations and compiler‑portable controls.

Audio and Reactive Systems

UI System (JSON UI)

FastLED includes a JSON‑driven UI layer that can expose controls (sliders, buttons, checkboxes, number fields, dropdowns, titles, descriptions, help, audio visualizers) for interactive demos and remote control.

Why: Build effects that respond to input signals.

Miscellaneous and Specialized


Guidance for New Users

Guidance for C++ Developers


This README will evolve alongside the codebase. If you are exploring a specific subsystem, start from the relevant headers listed above and follow includes to supporting modules.