-
Notifications
You must be signed in to change notification settings - Fork 226
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
GPIO: Refactor AnyPin to contain a u8
#2854
Conversation
009ddbb
to
5e80ef0
Compare
Flex::set_level
u8
@@ -3231,7 +3231,7 @@ impl Driver { | |||
// wait | |||
} | |||
} else if #[cfg(esp32)] { | |||
xtensa_lx::timer::delay(1); | |||
xtensa_lx::timer::delay(2); // ☠️ |
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.
any idea why we need this now?
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.
Not really :(
I can reproduce the 1.60 MHz for the erased case 🚀 |
The slight problem with that is, that we're not actually testing the performance of the erased GPIO, but the compilers ability to const-propagate the pin number. We need a better benchmark going forward |
We are relying a lot on the toolchains' optimization and here we try to please the compiler to produce better optimizations - maybe it would be good to have benchmarks in CI to avoid regressions in future (as good as it gets since optimizations are hard to predict - we already tried something like that for direct-vectored interrupts in hil-tests but suffered from flakiness) But I don't see a situation where this might make things worse |
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.
Nice, I'm glad this worked out! Whilst we are relying on the compiler, we kind of always are :D, but a benchmark/test for this in the future would be nice.
LGTM!
It seems like the compiler is WAY better at propagating a single
u8
than an enum of different types. My silly little benchmark is now completely const-propagated and toggles at 1.6MHz.As a neat bonus, we can now provide
AnyPin::steal