Skip to content

Commit 52d87f6

Browse files
authored
update to SPI
Found an error in the SPI class. Resolved and successfully tested.
1 parent 1e60ff7 commit 52d87f6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_ssd1306.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,14 @@ def __init__(self, width, height, spi, dc, res, cs, *,
185185
def write_cmd(self, cmd):
186186
"""Send a command to the SPI device"""
187187
self.d_or_c.value = 0
188-
with self.spi_device:
189-
self.spi_device.write(bytearray([cmd]))
188+
with self.spi_device as spi:
189+
spi.write(bytearray([cmd]))
190190

191191
def write_framebuf(self):
192192
"""write to the frame buffer via SPI"""
193193
self.d_or_c.value = 1
194-
with self.spi_device:
195-
self.spi_device.write(self.buffer)
194+
with self.spi_device as spi:
195+
spi.write(self.buffer)
196196

197197
def poweron(self):
198198
"""Turn power off on the device"""

0 commit comments

Comments
 (0)