From 7b3d7a382635307b03b0b94920272a04e7516395 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Sun, 6 Aug 2023 05:58:38 +0200 Subject: [PATCH] stm32: add note about Output/OutputOpenDrain drop behavior --- embassy-stm32/src/gpio.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index 0cc269cf..8fd48423 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs @@ -351,6 +351,10 @@ impl From for bool { } /// GPIO output driver. +/// +/// Note that pins will **return to their floating state** when `Output` is dropped. +/// If pins should retain their state indefinitely, either keep ownership of the +/// `Output`, or pass it to [`core::mem::forget`]. pub struct Output<'d, T: Pin> { pub(crate) pin: Flex<'d, T>, } @@ -418,6 +422,10 @@ impl<'d, T: Pin> Output<'d, T> { } /// GPIO output open-drain driver. +/// +/// Note that pins will **return to their floating state** when `OutputOpenDrain` is dropped. +/// If pins should retain their state indefinitely, either keep ownership of the +/// `OutputOpenDrain`, or pass it to [`core::mem::forget`]. pub struct OutputOpenDrain<'d, T: Pin> { pub(crate) pin: Flex<'d, T>, }