Skip to content

Commit 159ef46

Browse files
committed
wip less expensive neopixels
1 parent f8f16d6 commit 159ef46

File tree

2 files changed

+3226
-1703
lines changed

2 files changed

+3226
-1703
lines changed

edg/parts/Neopixel.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,24 +124,23 @@ def contents(self) -> None:
124124
self.assign(self.actual_basic_part, False)
125125

126126

127-
class Ws2812c_2020(Neopixel, JlcPart, FootprintBlock):
128-
"""WS2812C low-power Neopixel RGB LED in 2.0x2.0. 3.3v logic-level signal compatible."""
127+
class Ws2812c_2020_Device(JlcPart, FootprintBlock):
129128
def __init__(self) -> None:
130129
super().__init__()
131-
self.vdd.init_from(VoltageSink(
130+
self.vdd = self.Port(VoltageSink(
132131
voltage_limits=(3.7, 5.3) * Volt,
133132
current_draw=(0.001, 0.001 + 5*3) * mAmp, # 1 uA static + up to 5mA/ch
134133
))
135-
self.gnd.init_from(Ground())
136-
self.din.init_from(DigitalSink.from_supply(
134+
self.gnd = self.Port(Ground())
135+
self.din = self.Port(DigitalSink.from_supply(
137136
self.gnd, self.vdd,
138137
voltage_limit_tolerance=(-0.3, 0.7),
139138
input_threshold_abs=(0.7, 2.7),
140139
))
141-
self.dout.init_from(DigitalSource.from_supply(
140+
self.dout = self.Port(DigitalSource.from_supply(
142141
self.gnd, self.vdd,
143142
current_limits=0*mAmp(tol=0),
144-
))
143+
), optional=True)
145144

146145
def contents(self) -> None:
147146
self.footprint(
@@ -159,6 +158,18 @@ def contents(self) -> None:
159158
self.assign(self.actual_basic_part, False)
160159

161160

161+
class Ws2812c_2020(Neopixel):
162+
"""WS2812C low-power Neopixel RGB LED in 2.0x2.0. 3.3v logic-level signal compatible."""
163+
def __init__(self) -> None:
164+
super().__init__()
165+
self.device = self.Block(Ws2812c_2020_Device())
166+
self.cap = self.Block(DecouplingCapacitor(0.1*uFarad(tol=0.2)))
167+
self.connect(self.gnd, self.device.gnd, self.cap.gnd)
168+
self.connect(self.vdd, self.device.vdd, self.cap.pwr)
169+
self.connect(self.din, self.device.din)
170+
self.connect(self.dout, self.device.dout)
171+
172+
162173
class Sk6812_Side_A(Neopixel, FootprintBlock):
163174
"""SK6812-SIDE-A side-emitting Neopixel LED."""
164175
def __init__(self) -> None:

0 commit comments

Comments
 (0)