Skip to content

Commit b524a47

Browse files
committed
Make output GPIO pin with current state.
Add method `into_push_pull_output_with_current_state` to obtain a GPIO output pin without changing its current output state.
1 parent b58d509 commit b524a47

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/gpio.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,17 @@ where
820820
Pin::new()
821821
}
822822

823+
/// Configures the pin to operate as an push-pull output pin.
824+
/// The state will not be changed.
825+
#[inline]
826+
pub fn into_push_pull_output_with_current_state(
827+
mut self,
828+
cr: &mut <Self as HL>::Cr,
829+
) -> Pin<P, N, Output<PushPull>> {
830+
self.mode::<Output<PushPull>>(cr);
831+
Pin::new()
832+
}
833+
823834
/// Configures the pin to operate as an analog input pin
824835
#[inline]
825836
pub fn into_analog(mut self, cr: &mut <Self as HL>::Cr) -> Pin<P, N, Analog> {

0 commit comments

Comments
 (0)