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

Class Timing3Phase

ci/tools/led_timing_conversions.py:137–188  ·  view source on GitHub ↗

LED timing in 3-phase format (three-phase protocol). Protocol Timing: At T=0 : Line goes HIGH (start of bit) At T=T1 : Line goes LOW (for '0' bit) At T=T1+T2 : Line goes LOW (for '1' bit) At T=T1+T2+T3 : Cycle complete (ready for next bit) At

Source from the content-addressed store, hash-verified

135
136
137class Timing3Phase:
138 """LED timing in 3-phase format (three-phase protocol).
139
140 Protocol Timing:
141 At T=0 : Line goes HIGH (start of bit)
142 At T=T1 : Line goes LOW (for '0' bit)
143 At T=T1+T2 : Line goes LOW (for '1' bit)
144 At T=T1+T2+T3 : Cycle complete (ready for next bit)
145
146 Attributes:
147 T1: High time for '0' bit (nanoseconds)
148 T2: Additional high time for '1' bit (nanoseconds)
149 T3: Low tail duration (nanoseconds)
150 name: Human-readable chipset name
151 """
152
153 def __init__(self, T1: int, T2: int, T3: int, name: str = "") -> None:
154 """Initialize Timing3Phase."""
155 self.T1 = T1
156 self.T2 = T2
157 self.T3 = T3
158 self.name = name
159
160 @property
161 def duration(self) -> int:
162 """Total cycle duration (T1 + T2 + T3)."""
163 return self.T1 + self.T2 + self.T3
164
165 @property
166 def high_time_0(self) -> int:
167 """High time for '0' bit (T1)."""
168 return self.T1
169
170 @property
171 def high_time_1(self) -> int:
172 """High time for '1' bit (T1 + T2)."""
173 return self.T1 + self.T2
174
175 def __repr__(self) -> str:
176 """Return detailed representation."""
177 if self.name:
178 return (
179 f"Timing3Phase({self.name}: "
180 f"T1={self.T1}ns, T2={self.T2}ns, T3={self.T3}ns)"
181 )
182 return f"Timing3Phase(T1={self.T1}ns, T2={self.T2}ns, T3={self.T3}ns)"
183
184 def __str__(self) -> str:
185 """Return human-readable string."""
186 return (
187 f"T1={self.T1}ns, T2={self.T2}ns, T3={self.T3}ns (cycle={self.duration}ns)"
188 )
189
190
191def datasheet_to_phase3(ds: TimingDatasheet) -> Timing3Phase:

Calls

no outgoing calls