FastLED 3.9.15
Loading...
Searching...
No Matches

◆ make4PhaseTiming()

ChipsetTiming4Phase fl::make4PhaseTiming ( const ChipsetTiming & timing_3phase,
u32 tolerance_ns = 150 )

Create 4-phase RX timing from 3-phase chipset timing with tolerance.

Converts FastLED's 3-phase timing (T1, T2, T3) to 4-phase RX timing with configurable tolerance for signal variations.

3-phase encoding (FastLED chipset timing):

  • T1: High time for bit 0
  • T2: Additional high time for bit 1 (T1H = T1 + T2)
  • T3: Low time for bit 1 (T1L = T3) Note: Bit 0 low time is derived as T0L = T2 + T3

4-phase decoding (actual encoder output):

  • Bit 0: T0H (T1 high) + T0L ((T2+T3) low)
  • Bit 1: T1H ((T1+T2) high) + T1L (T3 low)

4-phase decoding thresholds with tolerance:

  • T0H: [T1 - tolerance_ns, T1 + tolerance_ns]
  • T0L: [(T2+T3) - tolerance_ns, (T2+T3) + tolerance_ns]
  • T1H: [(T1+T2) - tolerance_ns, (T1+T2) + tolerance_ns]
  • T1L: [T3 - tolerance_ns, T3 + tolerance_ns]
Parameters
timing_3phase3-phase chipset timing configuration
tolerance_nsTolerance for all timings (default: 150ns, accounts for jitter/drift)
Returns
ChipsetTiming4Phase 4-phase RX timing structure

Example:

ChipsetTiming ws2812b_tx{250, 625, 375, 280, "WS2812B"};
auto rx_timing = make4PhaseTiming(ws2812b_tx, 150);
// Results in:
// T0H: [100ns, 400ns], T0L: [850ns, 1150ns]
// T1H: [725ns, 1025ns], T1L: [225ns, 525ns]
ChipsetTiming4Phase make4PhaseTiming(const ChipsetTiming &timing_3phase, u32 tolerance_ns) FL_NOEXCEPT
Create 4-phase RX timing from 3-phase chipset timing with tolerance.
Definition rx.cpp.hpp:51
Generic chipset timing entry Provides T1, T2, T3 timing parameters in nanoseconds for any LED protoco...
Definition led_timing.h:86

Definition at line 51 of file rx.cpp.hpp.

52 {
53 // Calculate derived values from 3-phase timing
54 // The encoder uses:
55 // Bit 0: T1 high + (T2+T3) low
56 // Bit 1: (T1+T2) high + T3 low
57 u32 t0h = timing_3phase.T1; // Bit 0 high time
58 u32 t0l = timing_3phase.T2 + timing_3phase.T3; // Bit 0 low time
59 u32 t1h = timing_3phase.T1 + timing_3phase.T2; // Bit 1 high time
60 u32 t1l = timing_3phase.T3; // Bit 1 low time
61
63
64 // Bit 0 timing thresholds
65 result.t0h_min_ns = (t0h > tolerance_ns) ? (t0h - tolerance_ns) : 0;
66 result.t0h_max_ns = t0h + tolerance_ns;
67 result.t0l_min_ns = (t0l > tolerance_ns) ? (t0l - tolerance_ns) : 0;
68 result.t0l_max_ns = t0l + tolerance_ns;
69
70 // Bit 1 timing thresholds
71 result.t1h_min_ns = (t1h > tolerance_ns) ? (t1h - tolerance_ns) : 0;
72 result.t1h_max_ns = t1h + tolerance_ns;
73 result.t1l_min_ns = (t1l > tolerance_ns) ? (t1l - tolerance_ns) : 0;
74 result.t1l_max_ns = t1l + tolerance_ns;
75
76 // Reset pulse threshold
77 result.reset_min_us = timing_3phase.RESET;
78
79 // gap_tolerance_ns retains its default value of 0
80
81 return result;
82}
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
u32 RESET
Reset/latch time (microseconds)
Definition led_timing.h:90
u32 T2
Additional high time for bit 1 (nanoseconds)
Definition led_timing.h:88
u32 T3
Low tail duration (nanoseconds)
Definition led_timing.h:89
u32 T1
High time for bit 0 (nanoseconds)
Definition led_timing.h:87
4-phase RX timing thresholds for chipset detection
Definition rx.h:87

References FL_NOEXCEPT.

Referenced by autoResearchLowMemorySetup(), capture(), and AutoResearchRemoteControl::registerFunctions().

+ Here is the caller graph for this function: