-
Notifications
You must be signed in to change notification settings - Fork 3
Add first and count params to fill #13
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
base: main
Are you sure you want to change the base?
Conversation
igrek-xavier
commented
Apr 11, 2025
- allows fill to control all or part of a led strip
- inspired from Adafruit Dotstar Arduino library
- allows fill to control all or part of a led strip - inspired from Adafruit Dotstar Arduino library
Thanks for your PR. This sort of functionality is available via Python array slices. Would this meet your needs? For example: import neopixel
np = neopixel.NeoPixel(board.NEOPIXEL, 10)
np[0:7] = ((20,30,40)) *7 Any changes in the |
Dear @dhalbert thanks for your prompt reply and your pointer.
I have been using the same logic than in the Arduino C++ library to be exactly similar to the existing API so I was hoping it should not impact too much the API ? Much thanks for your support. |
Dear @dhalbert in order to accept my PR, do you need also to modify the API CPP pixelbuf shared and bindings modules ? Can I help on this one if necessary ? Much thanks |
@igrek-xavier Yes, adding to the C API would be necessary, and there may or may not be room for the additional C API on some boards that include the C version. Suppose you just added this function to your code (choose whatever name you want): def fancy_fill(pixelbuf, value, start, count):
pixelbuf[start: start+count] = (value,) * count Would that be sufficiently convenient? Default args could be added. I don't mean to sound negative, but this particular library (and the corresponding C library) we try to keep small so it can run on many boards, even those with minimal RAM and firmware space. |
@dhalbert thanks for your reply and you have a better vision of the whole CircuitPython support for all boards than I have. |