@@ -45,16 +45,14 @@ def __setitem__(self, pos, value):
45
45
# Handle if a slice of positions are passed in by setting the appropriate
46
46
# LED data values to the provided values.
47
47
if isinstance (pos , slice ):
48
- index = 0
49
48
for n in xrange (* pos .indices (self .size )):
50
- ws .ws2811_led_set (self .channel , n , value [index ])
51
- index += 1
49
+ ws .ws2811_led_set (self .channel , n , value )
52
50
# Else assume the passed in value is a number to the position.
53
51
else :
54
52
return ws .ws2811_led_set (self .channel , pos , value )
55
53
56
54
57
- class PixelStrip (object ):
55
+ class PixelStrip (_LED_Data ):
58
56
def __init__ (self , num , pin , freq_hz = 800000 , dma = 10 , invert = False ,
59
57
brightness = 255 , channel = 0 , strip_type = None , gamma = None ):
60
58
"""Class to represent a SK6812/WS281x LED display. Num should be the
@@ -91,6 +89,9 @@ def __init__(self, num, pin, freq_hz=800000, dma=10, invert=False,
91
89
92
90
# Initialize the channel in use
93
91
self ._channel = ws .ws2811_channel_get (self ._leds , channel )
92
+
93
+ super (PixelStrip , self ).__init__ (self ._channel , num )
94
+
94
95
ws .ws2811_channel_t_gamma_set (self ._channel , gamma )
95
96
ws .ws2811_channel_t_count_set (self ._channel , num )
96
97
ws .ws2811_channel_t_gpionum_set (self ._channel , pin )
0 commit comments