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

Add Bit transpose function to support piopixl8 #4219

Merged
merged 9 commits into from
Feb 19, 2021

Conversation

jepler
Copy link
Member

@jepler jepler commented Feb 18, 2021

We want to speed up writing neopixels by nearly 8x on RP2040 by placing multiple strands in parallel and driving them with PIO. This needs a very specific bit rearrangement calculation which is too slow to do in Python but can be done very efficiently in C.

Testing performed: with work-in-progress adafruit_piopixl8 library, drove 2 to 8 strands of 30 real LEDs each; also stress tested the library by driving 25600 imaginary LEDs at a rate of about 240,000 pixels/second (theoretical max: about 266,667 pixels/second)

.. this version can only handle exactly 8 bits "across".  The restriction
may be relaxed in a future revision.
@jepler jepler requested a review from tannewt February 18, 2021 19:28
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this start with _? How about calling it bitops or bufferops? That way we can put other similar math here.

shared-bindings/_bit_transpose/__init__.c Outdated Show resolved Hide resolved
shared-bindings/_bit_transpose/__init__.c Outdated Show resolved Hide resolved
@jepler
Copy link
Member Author

jepler commented Feb 18, 2021

Renamed to "bitops", improved documentation, made output required, made width= positional.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one super minor thing.

shared-bindings/bitops/__init__.c Outdated Show resolved Hide resolved
@jepler jepler merged commit 1cd4e45 into adafruit:main Feb 19, 2021
@jepler jepler deleted the bit_transpose branch February 19, 2021 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants