-
Notifications
You must be signed in to change notification settings - Fork 60
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
Disabling Tx, Rx pins during Sleep #230
Comments
Hmm, the Maybe the (PRs welcome, if you can get it to work!) |
it already has a |
btw, i made it work with this ugly workaround. manually changing otyper register without altering pin AlternateFunction mode. no need to reconstruct serial this could cause problems if you don't have the ownership of serial when you are calling these. /// Changes TxPin Pin Mode From Open-Drain to Push-Pull
fn enable_tx(pin_number: u8) {
unsafe {
(*GPIOA::ptr())
.otyper
.modify(|r, w| w.bits(r.bits() & !(0b1 << pin_number) | (0_u32 << pin_number)));
}
}
/// Changes TxPin Pin Mode From Push-Pull to Open-Drain
fn disable_tx(pin_number: u8) {
unsafe {
(*GPIOA::ptr())
.otyper
.modify(|r, w| w.bits(r.bits() & !(0b1 << pin_number) | (1_u32 << pin_number)));
}
} |
I have a STM32L071CBTx which is connected to another board wia Uart. I want to put my mcu in sleep mode when the other board power is off. but tx pin takes heavy current from mcu in sleep mode. so I need to change it to Floating Input before stop mode and revert it after wakeup. but I don't have access to tx pin after initiating serial. is there a way to do this or another way to disable Uart temporarily?
The text was updated successfully, but these errors were encountered: