@@ -123,6 +123,10 @@ def leds(self):
123123 else :
124124 yield item
125125
126+ @property
127+ def active_high (self ):
128+ return self [0 ].active_high
129+
126130
127131class LEDBoard (LEDCollection ):
128132 """
@@ -149,21 +153,23 @@ class LEDBoard(LEDCollection):
149153
150154 :param bool active_high:
151155 If ``True`` (the default), the :meth:`on` method will set all the
152- associates pins to HIGH. If ``False``, the :meth:`on` method will set
153- all pins to LOW (the :meth:`off` method always does the opposite).
156+ associated pins to HIGH. If ``False``, the :meth:`on` method will set
157+ all pins to LOW (the :meth:`off` method always does the opposite). This
158+ parameter can only be specified as a keyword parameter.
154159
155160 :param bool initial_value:
156161 If ``False`` (the default), all LEDs will be off initially. If
157162 ``None``, each device will be left in whatever state the pin is found
158163 in when configured for output (warning: this can be on). If ``True``,
159- the device will be switched on initially.
164+ the device will be switched on initially. This parameter can only be
165+ specified as a keyword parameter.
160166
161167 :param \*\*named_pins:
162- Sepcify GPIO pins that LEDs of the board are attached to, associated
168+ Specify GPIO pins that LEDs of the board are attached to, associating
163169 each LED with a property name. You can designate as many pins as
164- necessary and any name provided it's not already in use by something
165- else. You can also specify :class:`LEDBoard` instances to create
166- trees of LEDs.
170+ necessary and use any names, provided they're not already in use by
171+ something else. You can also specify :class:`LEDBoard` instances to
172+ create trees of LEDs.
167173 """
168174 def __init__ (self , * args , ** kwargs ):
169175 self ._blink_leds = []
@@ -346,26 +352,33 @@ class LEDBarGraph(LEDCollection):
346352 Specify the GPIO pins that the LEDs of the bar graph are attached to.
347353 You can designate as many pins as necessary.
348354
349- :param float initial_value:
350- The initial :attr:`value` of the graph given as a float between -1 and
351- +1. Defaults to 0.0. This parameter can only be specified as a keyword
352- parameter.
353-
354355 :param bool pwm:
355356 If ``True``, construct :class:`PWMLED` instances for each pin. If
356357 ``False`` (the default), construct regular :class:`LED` instances. This
357358 parameter can only be specified as a keyword parameter.
359+
360+ :param bool active_high:
361+ If ``True`` (the default), the :meth:`on` method will set all the
362+ associated pins to HIGH. If ``False``, the :meth:`on` method will set
363+ all pins to LOW (the :meth:`off` method always does the opposite). This
364+ parameter can only be specified as a keyword parameter.
365+
366+ :param float initial_value:
367+ The initial :attr:`value` of the graph given as a float between -1 and
368+ +1. Defaults to 0.0. This parameter can only be specified as a keyword
369+ parameter.
358370 """
359371
360372 def __init__ (self , * pins , ** kwargs ):
361373 # Don't allow graphs to contain collections
362374 for pin in pins :
363375 assert not isinstance (pin , LEDCollection )
364376 pwm = kwargs .pop ('pwm' , False )
377+ active_high = kwargs .pop ('active_high' , True )
365378 initial_value = kwargs .pop ('initial_value' , 0 )
366379 if kwargs :
367380 raise TypeError ('unexpected keyword argument: %s' % kwargs .popitem ()[0 ])
368- super (LEDBarGraph , self ).__init__ (* pins , pwm = pwm )
381+ super (LEDBarGraph , self ).__init__ (* pins , pwm = pwm , active_high = active_high )
369382 try :
370383 self .value = initial_value
371384 except :
0 commit comments