@@ -84,6 +84,51 @@ def __setitem__(self, index, value):
84
84
self ._neopixel [offset ] = value
85
85
self ._neopixel .show ()
86
86
87
+ def show (self ):
88
+ """
89
+ Pass through to underlying NeoPixel object.
90
+ For use when auto_write == False
91
+
92
+ Shows the new colors on the pixels themselves if they haven't already
93
+ been autowritten.
94
+ The colors may or may not be showing after this function returns because
95
+ it may be done asynchronously.
96
+ """
97
+ self ._neopixel .show ()
98
+
99
+ @property
100
+ def auto_write (self ):
101
+ """
102
+ Pass-through to the underlying NeoPixel object
103
+ True if the neopixels should immediately change when set. If False,
104
+ `show` must be called explicitly.
105
+
106
+ This example disables auto_write, sets every pixel, calls show(), then
107
+ re-enables auto-write. trellis.pixels.fill() should really be used here
108
+ since all pixels are the same, but this is just for the sake of example.
109
+
110
+ .. code-block:: python
111
+
112
+ import adafruit_trellism4
113
+
114
+ trellis = adafruit_trellism4.TrellisM4Express()
115
+
116
+ trellis.pixels.auto_write = False
117
+
118
+ for x in range(trellis.pixels.width):
119
+ for y in range(trellis.pixels.height):
120
+ trellis.pixels[x, y] = (0, 255, 0)
121
+
122
+ trellis.pixels.show() # must call show() when auto_write == False
123
+
124
+ trellis.pixels.auto_write = True
125
+ """
126
+ return self ._neopixel .auto_write
127
+
128
+ @auto_write .setter
129
+ def auto_write (self , val ):
130
+ self ._neopixel .auto_write = val
131
+
87
132
@property
88
133
def brightness (self ):
89
134
"""
0 commit comments