-
Notifications
You must be signed in to change notification settings - Fork 513
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
fast pin access #449
fast pin access #449
Conversation
Yes. Bit-banding is available on ARM Cortex-M3 which is the fastest/atomic way to set/reset IO pins. |
Good call satish - right now focus is primarily on the API (as you see the implementation is simple), when that API settles down feel free to add a bit-banding implementation if you wish. I'm curious exactly how much faster bit banding will be and how fast do we need it to be? |
4de912d
to
41d9ecc
Compare
May be a bit late, but for consistency with About bit-banding, I had used this macro in an RGBMatrixPanel lib together with Paul It`s not quite bit-banding, but it's atomic and somewhat fast too. http://community.particle.io/t/some-reusable-macros-and-stuff/8846 I did some timing tests on the interrupt routine that does other things too, but the port write was notably faster. http://community.particle.io/t/adafruit-16x32-rgb-led-matrix/5119/107 |
Yep, Mat made them all consistent with Fast at the end. I'm pretty excited about this bit-banding thing... have not experimented with that but it sounds super powerful for fast access. |
Oh, I like the bit banding. Nice catch @satishgn. @ScruffR, the whole port write IS fast and doing it with bit banding would not be faster IMO. But for single bit operations, to the user, it would be transparent via @m-mcgowan 's API but under the hood it would be as fast as it gets. @satishgn, I would love to see your propose implementation. |
We can expand with port writes as another PR. Is everyone happy with this as it is so it can be included for the imminent 0.4.2 release? |
I agree, do as another PR |
Has anyone really tested this? Personally I have not had the time but really want to before we release it. |
@technobly, tested what? Bit-banding or my @m-mcgowan, I'm fine with that 👍 |
Tested the speed of inline functions setting and clearing GPIO, vs macros we are currently using. Anyone have a scope besides me? |
@technobly, I have a scope and logic analyzer but I can only test late tonight or tomorrow. What did you test on (Core vs Photon) and what were the timings? Can you post your test code so I can duplicate? |
Easiest thing to do is look at v006 of the NeoPixel library with a scope. First verify my documented timings with a scope for WS2812B with Photon and Core, not logic analyzer. Then swap out the macros for these new inline functions. Appreciate the help Paul! |
Hi Everone, I'm preparing a 0.4.2 release, so going to merge this in. If any bugfixes are needed, we can discuss those as separate issues. |
This covers fast pin set/reset. Does anyone have a suggestion for multiple pin set/reset, port access etc..?