stm32f3xx-hal icon indicating copy to clipboard operation
stm32f3xx-hal copied to clipboard

Implement GPIO temporary mode closures

Open Sh3Rm4n opened this issue 3 years ago • 2 comments

This should be similar to https://github.com/stm32-rs/stm32l0xx-hal/pull/74

Sh3Rm4n avatar Oct 07 '21 06:10 Sh3Rm4n

The other approach already merged to embedded-hal: https://github.com/rust-embedded/embedded-hal/issues/29

apatrushev avatar Oct 18 '21 22:10 apatrushev

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.

Sh3Rm4n avatar Oct 19 '21 05:10 Sh3Rm4n