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

GPIO: Refactor AnyPin to contain a u8 #2854

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bugadani
Copy link
Contributor

@bugadani bugadani commented Dec 20, 2024

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

@bugadani bugadani added the skip-changelog No changelog modification needed label Dec 20, 2024
@bugadani bugadani force-pushed the gpio-opt branch 2 times, most recently from 009ddbb to 5e80ef0 Compare December 20, 2024 13:28
@bugadani bugadani changed the title GPIO: Remove panicking match from Flex::set_level GPIO: Refactor AnyPin to contain a u8 Dec 20, 2024
@@ -3231,7 +3231,7 @@ impl Driver {
// wait
}
} else if #[cfg(esp32)] {
xtensa_lx::timer::delay(1);
xtensa_lx::timer::delay(2); // ☠️
Copy link
Contributor

@bjoernQ bjoernQ Dec 20, 2024

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really :(

@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 20, 2024

I can reproduce the 1.60 MHz for the erased case 🚀

@bugadani
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants