mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-12-08 20:39:01 +00:00
@@ -116,19 +116,22 @@ class LEDCollection(CompositeOutputDevice):
|
|||||||
LEDClass(pin_or_collection, active_high, initial_value)
|
LEDClass(pin_or_collection, active_high, initial_value)
|
||||||
for name, pin_or_collection in kwargs.items()
|
for name, pin_or_collection in kwargs.items()
|
||||||
})
|
})
|
||||||
|
leds = []
|
||||||
|
for item in self:
|
||||||
|
if isinstance(item, LEDCollection):
|
||||||
|
for subitem in item.leds:
|
||||||
|
leds.append(subitem)
|
||||||
|
else:
|
||||||
|
leds.append(item)
|
||||||
|
self._leds = tuple(leds)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def leds(self):
|
def leds(self):
|
||||||
"""
|
"""
|
||||||
A flat iterator over all LEDs contained in this collection (and all
|
A flat tuple of all LEDs contained in this collection (and all
|
||||||
sub-collections).
|
sub-collections).
|
||||||
"""
|
"""
|
||||||
for item in self:
|
return self._leds
|
||||||
if isinstance(item, LEDCollection):
|
|
||||||
for subitem in item.leds:
|
|
||||||
yield subitem
|
|
||||||
else:
|
|
||||||
yield item
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_high(self):
|
def active_high(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user