-
Notifications
You must be signed in to change notification settings - Fork 101
Add SPI driven NeoPixel. #53
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
Conversation
neopixel.py
Outdated
|
||
def _transmogrify(self): | ||
"""Turn every BIT of buf into a special BYTE pattern.""" | ||
out_buf = bytearray() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we can pre-alloc the size of the bytearray instead of using append, that will be much faster :)
Wonder if I could get that down to just the one buffer... |
...yes, but kind of pulls a thread, so I think best saved for a follow on PR. |
agreed! i was looking for speed increase, not memory reduction |
works once brightness adjust is done - see line you need to add :) |
Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.0.1 from 3.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#78 from brentru/add-cert-psk-bools Updating https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel to 3.4.0 from 3.3.7: > Merge pull request adafruit/Adafruit_CircuitPython_NeoPixel#53 from caternuson/spi_neopixel Updating https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display to 3.4.2 from 3.4.0: > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#35 from makermelissa/master > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#34 from makermelissa/master Updating https://github.com/adafruit/Adafruit_CircuitPython_FancyLED to 1.3.2 from 1.3.1: > Merge pull request adafruit/Adafruit_CircuitPython_FancyLED#14 from devoh747/devoh747
Sorry that I missed this when it was added but this is not the right spot for this change. Instead, I think this should be done as a Either way, Thanks! |
we could also make a new library that subclasses this one ? |
@ladyada You could but I don't think that is what you want. What do you want to support besides FT232? |
handy if people are bringing up new boards that dont have neopixel_write, for any other linux boards |
@ladyada Wouldn't having it in Blinka work for that? |
yes! there's no reason it wouldnt work for plain circuitpython boards ... wouldn't make a lot of sense to use since we normally add neopixel_write when we port...but perhaps others (like spresense?) would not get to it.... Neopixel_SPI its a generic library that only depends on busio |
@tannewt, it works on some boards, but not others. Like I think it worked on the Raspberry Pi, but not the Orange Pi. |
The generic use case for Neopixel_SPI is for boards that have a hardware SPI peripheral, but can not otherwise output the data signal on a low level pin. This hack doesn't work on any pin, just the MOSI pin of a hardware SPI port. It essentially off loads the neopixel timing requirement to the SPI peripheral. That's the reasoning for it taking in the SPI instance: pixels = neopixel.NeoPixel_SPI(board.SPI(), 10) which then allows Do we need a special place for libraries that are only needed by hardware using Blinka? The Blinka repo itself is just the shim to make it all work, so maybe not the best place? |
If we want to use this on CircuitPython as well as Blinka, let's split it out into its own library. If we want it just for Blinka then we can add it as a |
yeah, id rather have it in a proper library - its pure python and github repos are freeee :) |
OK, I can set up the separate lib repo. Repo name = |
yeah add to the bundle, name should match the object which is Adafruit_CircuitPython_NeoPixel_SPI right? |
Works for me. @tannewt work for you? |
@caternuson Either is fine with me as long as the module name matches. |
Add a class,
NeoPixel_SPI
, that takes in a SPI bus object and uses its MOSI pin to synthesize a NeoPixel data stream.Basic usage example:
Things I'm not super jazzed about:
self.RESET
) on the write.