@@ -48,8 +48,8 @@ def __init__(self, clock=board.D13, data=board.D11, brightness=0.2):
48
48
self .rows = 6
49
49
self .columns = 12
50
50
self ._auto_write = True
51
- self ._display = dotstar .DotStar (clock , data , self .rows * self .columns ,
52
- brightness = brightness , auto_write = False )
51
+ self ._matrix = dotstar .DotStar (clock , data , self .rows * self .columns ,
52
+ brightness = brightness , auto_write = False )
53
53
54
54
def __setitem__ (self , indices , value ):
55
55
"""
@@ -63,7 +63,7 @@ def __setitem__(self, indices, value):
63
63
a single, longer int that contains RGB values, like 0xFFFFFF
64
64
brightness, if specified should be a float 0-1
65
65
"""
66
- self ._display [self ._get_index (indices )] = value
66
+ self ._matrix [self ._get_index (indices )] = value
67
67
self ._update ()
68
68
69
69
def __getitem__ (self , indices ):
@@ -73,7 +73,7 @@ def __getitem__(self, indices):
73
73
a slice of DotStar indexes to retrieve
74
74
a single int that specifies the DotStar index
75
75
"""
76
- return self ._display [self ._get_index (indices )]
76
+ return self ._matrix [self ._get_index (indices )]
77
77
78
78
def _get_index (self , indices ):
79
79
"""
@@ -119,7 +119,7 @@ def fill(self, color=0):
119
119
dotstar.fill() # Clear all lit DotStars
120
120
121
121
"""
122
- self ._display .fill (color )
122
+ self ._matrix .fill (color )
123
123
self ._update ()
124
124
125
125
def show (self ):
@@ -142,7 +142,7 @@ def show(self):
142
142
dotstar.show() # Update the DotStars
143
143
144
144
"""
145
- self ._display .show ()
145
+ self ._matrix .show ()
146
146
147
147
def shift_right (self , rotate = False ):
148
148
"""
@@ -176,10 +176,10 @@ def shift_right(self, rotate=False):
176
176
177
177
"""
178
178
for y in range (0 , self .rows ):
179
- last_pixel = self ._display [(y + 1 ) * self .columns - 1 ] if rotate else 0
179
+ last_pixel = self ._matrix [(y + 1 ) * self .columns - 1 ] if rotate else 0
180
180
for x in range (self .columns - 1 , 0 , - 1 ):
181
- self ._display [y * self .columns + x ] = self ._display [y * self .columns + x - 1 ]
182
- self ._display [y * self .columns ] = last_pixel
181
+ self ._matrix [y * self .columns + x ] = self ._matrix [y * self .columns + x - 1 ]
182
+ self ._matrix [y * self .columns ] = last_pixel
183
183
self ._update ()
184
184
185
185
def shift_left (self , rotate = False ):
@@ -214,10 +214,10 @@ def shift_left(self, rotate=False):
214
214
215
215
"""
216
216
for y in range (0 , self .rows ):
217
- last_pixel = self ._display [y * self .columns ] if rotate else 0
217
+ last_pixel = self ._matrix [y * self .columns ] if rotate else 0
218
218
for x in range (0 , self .columns - 1 ):
219
- self ._display [y * self .columns + x ] = self ._display [y * self .columns + x + 1 ]
220
- self ._display [(y + 1 ) * self .columns - 1 ] = last_pixel
219
+ self ._matrix [y * self .columns + x ] = self ._matrix [y * self .columns + x + 1 ]
220
+ self ._matrix [(y + 1 ) * self .columns - 1 ] = last_pixel
221
221
self ._update ()
222
222
223
223
def shift_up (self , rotate = False ):
@@ -252,10 +252,10 @@ def shift_up(self, rotate=False):
252
252
253
253
"""
254
254
for x in range (0 , self .columns ):
255
- last_pixel = self ._display [(self .rows - 1 ) * self .columns + x ] if rotate else 0
255
+ last_pixel = self ._matrix [(self .rows - 1 ) * self .columns + x ] if rotate else 0
256
256
for y in range (self .rows - 1 , 0 , - 1 ):
257
- self ._display [y * self .columns + x ] = self ._display [(y - 1 ) * self .columns + x ]
258
- self ._display [x ] = last_pixel
257
+ self ._matrix [y * self .columns + x ] = self ._matrix [(y - 1 ) * self .columns + x ]
258
+ self ._matrix [x ] = last_pixel
259
259
self ._update ()
260
260
261
261
def shift_down (self , rotate = False ):
@@ -290,18 +290,18 @@ def shift_down(self, rotate=False):
290
290
291
291
"""
292
292
for x in range (0 , self .columns ):
293
- last_pixel = self ._display [x ] if rotate else 0
293
+ last_pixel = self ._matrix [x ] if rotate else 0
294
294
for y in range (0 , self .rows - 1 ):
295
- self ._display [y * self .columns + x ] = self ._display [(y + 1 ) * self .columns + x ]
296
- self ._display [(self .rows - 1 ) * self .columns + x ] = last_pixel
295
+ self ._matrix [y * self .columns + x ] = self ._matrix [(y + 1 ) * self .columns + x ]
296
+ self ._matrix [(self .rows - 1 ) * self .columns + x ] = last_pixel
297
297
self ._update ()
298
298
299
299
def _update (self ):
300
300
"""
301
301
Update the Display automatically if auto_write is set to True
302
302
"""
303
303
if self ._auto_write :
304
- self ._display .show ()
304
+ self ._matrix .show ()
305
305
306
306
@property
307
307
def auto_write (self ):
@@ -356,9 +356,9 @@ def brightness(self):
356
356
dotstar.brightness = 0.3
357
357
358
358
"""
359
- return self ._display .brightness
359
+ return self ._matrix .brightness
360
360
361
361
@brightness .setter
362
362
def brightness (self , brightness ):
363
- self ._display .brightness = min (max (brightness , 0.0 ), 1.0 )
363
+ self ._matrix .brightness = min (max (brightness , 0.0 ), 1.0 )
364
364
self ._update ()
0 commit comments