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

Implement GPIO temporary mode closures #289

Open
Sh3Rm4n opened this issue Oct 7, 2021 · 2 comments
Open

Implement GPIO temporary mode closures #289

Sh3Rm4n opened this issue Oct 7, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@Sh3Rm4n
Copy link
Member

Sh3Rm4n commented Oct 7, 2021

This should be similar to stm32-rs/stm32l0xx-hal#74

@Sh3Rm4n Sh3Rm4n added the enhancement New feature or request label Oct 7, 2021
@apatrushev
Copy link
Contributor

The other approach already merged to embedded-hal:
rust-embedded/embedded-hal#29

@Sh3Rm4n
Copy link
Member Author

Sh3Rm4n commented Oct 19, 2021

Yeah, IoPin has also to be implemented for this HAL. Thanks for the reminder :)

But this solves a slightly different issue. This is a particular API to solve the "Option-dance", too please the rust borrow checker. Because changing the pins mode, changes its pin type state / type signature, which rustc is not happy about, if the pin it is not owned (which always is the case, when it is static mut). To solve this, you either have to use the "Option-dance", a pattern I've been using in the testsuite quite heavily, or introduce an API suggested in the linked issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants