|
FastLED 3.10.6
|
| 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: