FastLED 3.10.8
Loading...
Searching...
No Matches

◆ push()

FL_OPTIMIZE_FUNCTION void fl::channels::rx::Ws2812StreamDecoder::push ( fl::span< const u16 > captures)

Consume capture pairs laid out as [rise0, fall0, rise1, fall1...].

Definition at line 218 of file ws2812_stream_decoder.cpp.hpp.

218 {
219 const size_t pair_count = captures.size() / 2u;
220 for (size_t p = 0; p < pair_count; ++p) {
221 const u16 rise = captures[2 * p];
222 const u16 fall = captures[2 * p + 1];
223 ++mStats.pairs;
224 if (mHavePrev) {
225 const u32 low_ns = flexPwmTickDeltaNs(mPrevFall, rise, mNsPerTickQ16);
226 const bool has_low = low_ns <= kFlexPwmGapNs;
227 // Leading phantom pairs (#3219, #3409): the arm sequence can
228 // latch a stray pair followed by an idle gap. Drop any leading
229 // pair whose LOW is a gap.
230 if (mStarted || has_low) {
231 mStarted = true;
232 emitPair(mPrevRise, mPrevFall, has_low, low_ns);
233 }
234 }
235 mPrevRise = rise;
236 mPrevFall = fall;
237 mHavePrev = true;
238 }
239}
void emitPair(u16 rise, u16 fall, bool has_low, u32 low_ns) FL_NO_EXCEPT
constexpr fl::size size() const FL_NO_EXCEPT
Definition span.h:483
constexpr u32 kFlexPwmGapNs
A LOW longer than this ends the bit without a LOW edge (gap or reset).
u32 flexPwmTickDeltaNs(u16 t0, u16 t1, u32 ns_per_tick_q16) FL_NO_EXCEPT
Convert a 16-bit capture-counter delta to ns.

References emitPair(), fl::FL_NO_EXCEPT, FL_OPTIMIZE_FUNCTION, fl::channels::rx::flexPwmTickDeltaNs(), fl::channels::rx::kFlexPwmGapNs, mHavePrev, mNsPerTickQ16, mPrevFall, mPrevRise, mStarted, and mStats.

+ Here is the call graph for this function: