FastLED 3.10.6
Loading...
Searching...
No Matches
uart_wave_encoder.cpp.hpp File Reference

Detailed Description

Implementation of the platform-neutral UART waveN encoder.

Implements dynamic LUT generation from chipset timing and the timing feasibility predicate. The wave10 model treats the 10-bit UART frame as two 5-pulse LED bit slots.

Definition in file uart_wave_encoder.cpp.hpp.

+ Include dependency graph for uart_wave_encoder.cpp.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::UartWaveFit
 Fit result for one UART wave geometry (P pulses per LED bit) More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 
namespace  fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}
 

Functions

u32 fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::absDiff (u32 a, u32 b) FL_NO_EXCEPT
 Absolute value of difference (unsigned-safe)
 
u8 fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::buildUartByte (u8 pulses_a, u8 pulses_b, u8 pulses_per_bit=5) FL_NO_EXCEPT
 Build a UART data byte from two LED bit pulse counts.
 
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.
 
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.
 
u8 fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::computePulseCount (u32 timing_ns, u32 pulse_width_ns) FL_NO_EXCEPT
 Compute HIGH pulse count for a given timing value.
 
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.
 
UartWaveFit fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::fitUartWave (const ChipsetTimingConfig &timing, u8 pulses_per_bit, u32 max_baud_rate) FL_NO_EXCEPT
 Evaluate whether P pulses/LED-bit can represent the timing.
 
ChipsetTiming fl::uartWireTiming (const ChipsetTimingConfig &timing, u32 max_baud_rate) FL_NO_EXCEPT
 The wire timing the UART encoder actually produces for a chipset.
 

Class Documentation

◆ fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::UartWaveFit

struct fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::UartWaveFit
Class Members
u32 max_err_ns Worst single-symbol error, measured pre-bump.

total_err_ns cannot distinguish 125 ns spread over two symbols from 200 ns concentrated in one, and only the concentrated case leaves a symbol outside what a receiver will classify (FastLED#4379).

Pre-bump because the separation widening below is deliberate – it moves T1H away from T0H on purpose and a longer HIGH still reads as 1 – so charging it as error would relitigate #3569/#3572 rather than measure rounding.

bool ok
u8 pulses_0
u8 pulses_1
u32 total_err_ns |T0H err| + |T1H err| vs nominal, post-bump