|
FastLED 3.10.6
|
Platform-neutral UART wave4/wave5 encoder API.
This encoder uses a "wave10" model that treats the full 10-bit UART frame (START + 8 data + STOP) as the fundamental encoding unit. With TX inversion, START=HIGH and STOP=LOW, giving 5 controllable pulses per LED bit (2 LED bits per frame).
The implementation originated with the ESP UART backend, but it models only an inverted UART frame and ChipsetTimingConfig; ESP UART, RP UART DMA, and future backends all consume this stable channel-layer API.
Unlike wave8 (8 pulses per bit for PARLIO/SPI), wave10 accounts for UART's automatic start/stop bits as part of the waveform:
The LUT is computed from chipset timing (T1/T2/T3) rather than hardcoded, enabling support for any clockless LED protocol (WS2812, SK6812, WS2811, etc.)
A chipset is compatible when:
Definition in file uart_wave_encoder.h.
#include "fl/chipsets/chipset_timing_config.h"#include "fl/stl/compiler_control.h"#include "fl/stl/isr/memcpy.h"#include "fl/stl/cstddef.h"#include "fl/stl/stdint.h"#include "fl/stl/noexcept.h"
Include dependency graph for uart_wave_encoder.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | fl::Wave10Lut |
| Wave lookup table for UART LED encoding (waveN family) More... | |
Namespaces | |
| namespace | fl |
| Base definition for an LED controller. | |
| namespace | fl::detail |
Compile-time linker keep-alive hook for a single fl::Bus. | |
Functions | |
| Wave10Lut | fl::buildWave10Lut (const ChipsetTimingConfig &timing) FL_NO_EXCEPT |
| Build a Wave10 LUT from chipset timing parameters. | |
| Wave10Lut | fl::buildWave10LutForMaxBaud (const ChipsetTimingConfig &timing, u32 max_baud_rate) FL_NO_EXCEPT |
| Build a UART waveform LUT with a backend-specific baud ceiling. | |
| FASTLED_FORCE_INLINE constexpr size_t | fl::calculateUartBufferSize (size_t input_size) FL_NO_EXCEPT |
| Calculate required output buffer size for LED encoding. | |
| FASTLED_FORCE_INLINE constexpr size_t | fl::calculateUartBufferSizeForLeds (size_t num_leds) FL_NO_EXCEPT |
| Calculate required output buffer size for RGB LED encoding. | |
| bool | fl::canRepresentTiming (const ChipsetTimingConfig &timing) FL_NO_EXCEPT |
| Check if a chipset timing can be accurately represented by UART. | |
| bool | fl::canRepresentTimingForMaxBaud (const ChipsetTimingConfig &timing, u32 max_baud_rate) FL_NO_EXCEPT |
| Timing feasibility with a backend-specific baud ceiling. | |
| FL_IRAM FL_OPTIMIZE_FUNCTION size_t | fl::encodeLedsToUart (const u8 *input, size_t input_size, u8 *output, size_t output_capacity) FL_NO_EXCEPT |
| Legacy encoding using hardcoded WS2812 LUT (backward compat) | |
| FL_IRAM FL_OPTIMIZE_FUNCTION size_t | fl::encodeLedsToUart (const u8 *input, size_t input_size, u8 *output, size_t output_capacity, const Wave10Lut &lut) FL_NO_EXCEPT |
| Encode LED pixel data to UART bytes using a Wave10 LUT. | |
| FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION u8 | fl::detail::encodeUart2Bits (u8 two_bits) FL_NO_EXCEPT |
| Legacy 2-bit encoding using hardcoded WS2812 LUT (backward compat) | |
| FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION u8 | fl::detail::encodeUart2Bits (u8 two_bits, const Wave10Lut &lut) FL_NO_EXCEPT |
| Encode 2 LED bits to 1 UART byte using a Wave10 LUT. | |
| FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION void | fl::detail::encodeUartByte (u8 led_byte, u8 *output) FL_NO_EXCEPT |
| Legacy byte encoding using hardcoded WS2812 LUT (backward compat) | |
| FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION void | fl::detail::encodeUartByte (u8 led_byte, u8 *output, const Wave10Lut &lut) FL_NO_EXCEPT |
| Encode 1 LED byte to 4 UART bytes using a Wave10 LUT. | |
| ChipsetTiming | fl::uartWireTiming (const ChipsetTimingConfig &timing, u32 max_baud_rate) FL_NO_EXCEPT |
| The wire timing the UART encoder actually produces for a chipset. | |
Variables | |
| constexpr u32 | fl::kMaxUartBaudRate = 5000000 |
| Maximum UART baud rate supported by ESP32 variants. | |