|
FastLED 3.10.6
|
Classes | |
| struct | UartWaveFit |
| Fit result for one UART wave geometry (P pulses per LED bit) More... | |
Functions | |
| u32 | absDiff (u32 a, u32 b) FL_NO_EXCEPT |
| Absolute value of difference (unsigned-safe) | |
| u8 | 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. | |
| u8 | computePulseCount (u32 timing_ns, u32 pulse_width_ns) FL_NO_EXCEPT |
| Compute HIGH pulse count for a given timing value. | |
| UartWaveFit | 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. | |
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.
| u32 fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::absDiff | ( | u32 | a, |
| u32 | b ) |
Absolute value of difference (unsigned-safe)
Definition at line 22 of file uart_wave_encoder.cpp.hpp.
References absDiff(), and fl::FL_NO_EXCEPT.
Referenced by absDiff(), computePulseCount(), and fitUartWave().
Here is the call graph for this function:
Here is the caller graph for this function:| u8 fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::buildUartByte | ( | u8 | pulses_a, |
| u8 | pulses_b, | ||
| u8 | pulses_per_bit = 5 ) |
Build a UART data byte from two LED bit pulse counts.
Constructs the 8-bit UART data value that, with TX inversion and LSB-first transmission, produces the desired wire waveform.
Wire model (10 bits with TX inversion): [START=H] [~D0] [~D1] [~D2] [~D3] [~D4] [~D5] [~D6] [~D7] [STOP=L]
LED bit A occupies positions 0-4 (START + D0..D3): START is always HIGH (1 pulse guaranteed) D0..D3 set HIGH for (pulses_a - 1) additional pulses, then LOW
LED bit B occupies positions 5-9 (D4..D7 + STOP): D4 must be HIGH for leading edge (1 pulse guaranteed) D5..D7 set HIGH for (pulses_b - 1) additional pulses, then LOW STOP is always LOW
| pulses_a | HIGH pulse count for LED bit A [1, 4] |
| pulses_b | HIGH pulse count for LED bit B [1, 4] |
Definition at line 66 of file uart_wave_encoder.cpp.hpp.
References buildUartByte(), fl::FL_NO_EXCEPT, and fl::P().
Referenced by buildUartByte().
Here is the call graph for this function:
Here is the caller graph for this function:| u8 fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::computePulseCount | ( | u32 | timing_ns, |
| u32 | pulse_width_ns ) |
Compute HIGH pulse count for a given timing value.
| timing_ns | Timing value in nanoseconds (T0H or T1H) |
| pulse_width_ns | Width of each pulse in nanoseconds |
Tries both floor and ceil, picks the one with smaller error. Ties are broken by preferring the lower (floor) value, which keeps the HIGH time shorter – safer for most LED protocols. For example, WS2812 T1H=875ns at 250ns/pulse: floor=3 (750ns, err=125), ceil=4 (1000ns, err=125) -> picks 3 (shorter HIGH time).
Definition at line 36 of file uart_wave_encoder.cpp.hpp.
References absDiff(), computePulseCount(), and fl::FL_NO_EXCEPT.
Referenced by computePulseCount(), and fitUartWave().
Here is the call graph for this function:
Here is the caller graph for this function:| UartWaveFit fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::fitUartWave | ( | const ChipsetTimingConfig & | timing, |
| u8 | pulses_per_bit, | ||
| u32 | max_baud_rate ) |
Evaluate whether P pulses/LED-bit can represent the timing.
Shared by buildWave10Lut() and canRepresentTiming() so the LUT that gets built is always judged by the same rules that admitted it.
Definition at line 126 of file uart_wave_encoder.cpp.hpp.
References absDiff(), computePulseCount(), fitUartWave(), fl::FL_NO_EXCEPT, fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::UartWaveFit::max_err_ns, fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::UartWaveFit::ok, fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::UartWaveFit::pulses_0, fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::UartWaveFit::pulses_1, and fl::anonymous_namespace{uart_wave_encoder.cpp.hpp}::UartWaveFit::total_err_ns.
Referenced by fitUartWave().
Here is the call graph for this function:
Here is the caller graph for this function: