Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions adafruit_dotstar.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def __init__(
self._spi = None
try:
self._spi = busio.SPI(clock, MOSI=data)
while not self._spi.try_lock():
pass
self._spi.try_lock()
self._spi.configure(baudrate=baudrate)
self._spi.unlock()

except (NotImplementedError, ValueError):
self.dpin = digitalio.DigitalInOut(data)
Expand Down Expand Up @@ -145,7 +145,6 @@ def deinit(self) -> None:
self.fill(0)
self.show()
if self._spi:
self._spi.unlock()
self._spi.deinit()
else:
self.dpin.deinit()
Expand Down Expand Up @@ -174,7 +173,9 @@ def n(self) -> int:

def _transmit(self, buffer: ReadableBuffer) -> None:
if self._spi:
self._spi.try_lock()
self._spi.write(buffer)
self._spi.unlock()
else:
self._ds_writebytes(buffer)

Expand Down