-
Notifications
You must be signed in to change notification settings - Fork 88
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
Set multiple pins at once? #122
Comments
Thanks for the suggestion! While RPPAL doesn't currently provide that functionality, It would technically be possible to combine register writes for multiple pins. I can imagine a The BCM2711 uses 4 registers to set/clear pin states (GPSET0, GPSET1, GPCLR0, GPCLR1). In the worst case scenario you'd go from writing 6 32-bit values to 4 (possibly as a single 128-bit write), plus the overhead (either in the library or the end-user code) of sorting through the list of pins. I think it's worth implementing as a convenience function for parallel interfaces, with any performance gains as a bonus. I'll put this on the list of requested changes and see if we can get it into a future update. |
Thanks for considering it. I'm actually getting pretty acceptable performance from what I can tell (though I don't have a logic analyzer at home for my hobby projects) setting them one at a time. If it's just a convenience function, I can just write a wrapper that takes an array of pins. In hindsight, trying to set them via the set/clear registers potentially adds a lot of support work since it might be unique to each Raspberry PI SOC. |
Is it possible to set multiple pins at once, through something like GPIO register masking or a multiple set/multiple clear register? It sounds like the Python interface can set or clear multiple simultaneously. I am trying to write my own HUB75 driver, and it would be nice to be able to set and clear all 6 bits (R0, R1, G0, G1, B1, and B2) in a single write.
The text was updated successfully, but these errors were encountered: