MCPcopy Create free account
hub / github.com/FastLED/FastLED / make4PhaseTiming

Function make4PhaseTiming

src/fl/channels/rx.cpp.hpp:51–82  ·  view source on GitHub ↗

Implementation of make4PhaseTiming function

Source from the content-addressed store, hash-verified

49
50// Implementation of make4PhaseTiming function
51ChipsetTiming4Phase make4PhaseTiming(const ChipsetTiming& timing_3phase,
52 u32 tolerance_ns) FL_NOEXCEPT {
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
62 ChipsetTiming4Phase result;
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}
83
84} // namespace fl
85

Callers 3

captureFunction · 0.85
registerFunctionsMethod · 0.85

Calls

no outgoing calls

Tested by 1

captureFunction · 0.68