Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to import bitbangio if busio SPI is not available #40

wants to merge 1 commit into
base: master
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -85,17 +85,23 @@ def __init__(self, clock, data, n, *, brightness=1.0, auto_write=True,
pixel_order=BGR, baudrate=4000000):
self._spi = None
self._spi = busio.SPI(clock, MOSI=data)
self._spi = busio.SPI(clock, MOSI=data)
except (NotImplementedError, ValueError):
import bitbangio
self._spi = bitbangio.SPI(clock, MOSI=data)

while not self._spi.try_lock():

except (NotImplementedError, ValueError):
except (NotImplementedError, ValueError, ImportError):
self.dpin = digitalio.DigitalInOut(data)
self.cpin = digitalio.DigitalInOut(clock)
self.dpin.direction = digitalio.Direction.OUTPUT
self.cpin.direction = digitalio.Direction.OUTPUT
self.cpin.value = False

self._n = n
# Supply one extra clock cycle for each two pixels in the strip.
self.end_header_size = n // 16
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.