Struct embassy_stm32::gpio::OutputOpenDrain
source · pub struct OutputOpenDrain<'d, T: Pin> { /* private fields */ }
Expand description
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
.
Implementations§
source§impl<'d, T: Pin> OutputOpenDrain<'d, T>
impl<'d, T: Pin> OutputOpenDrain<'d, T>
sourcepub fn new(
pin: impl Peripheral<P = T> + 'd,
initial_output: Level,
speed: Speed,
pull: Pull
) -> Self
pub fn new( pin: impl Peripheral<P = T> + 'd, initial_output: Level, speed: Speed, pull: Pull ) -> Self
sourcepub fn degrade(self) -> Output<'d, AnyPin>
pub fn degrade(self) -> Output<'d, AnyPin>
Type-erase (degrade) this pin into an AnyPin
.
This converts pin singletons (PA5
, PB6
, …), which
are all different types, into the same type. It is useful for
creating arrays of pins, or avoiding generics.
sourcepub fn is_set_high(&self) -> bool
pub fn is_set_high(&self) -> bool
Get whether the output level is set to high.
sourcepub fn is_set_low(&self) -> bool
pub fn is_set_low(&self) -> bool
Get whether the output level is set to low.
sourcepub fn get_output_level(&self) -> Level
pub fn get_output_level(&self) -> Level
Get the current output level.
Trait Implementations§
source§impl<'d, T: Pin> ErrorType for OutputOpenDrain<'d, T>
impl<'d, T: Pin> ErrorType for OutputOpenDrain<'d, T>
§type Error = Infallible
type Error = Infallible
Error type
source§impl<'d, T: Pin> InputPin for OutputOpenDrain<'d, T>
impl<'d, T: Pin> InputPin for OutputOpenDrain<'d, T>
source§impl<'d, T: Pin> OutputPin for OutputOpenDrain<'d, T>
impl<'d, T: Pin> OutputPin for OutputOpenDrain<'d, T>
§type Error = Infallible
type Error = Infallible
Error type
source§impl<'d, T: Pin> OutputPin for OutputOpenDrain<'d, T>
impl<'d, T: Pin> OutputPin for OutputOpenDrain<'d, T>
source§impl<'d, T: Pin> StatefulOutputPin for OutputOpenDrain<'d, T>
impl<'d, T: Pin> StatefulOutputPin for OutputOpenDrain<'d, T>
source§impl<'d, T: Pin> StatefulOutputPin for OutputOpenDrain<'d, T>
impl<'d, T: Pin> StatefulOutputPin for OutputOpenDrain<'d, T>
source§impl<'d, T: Pin> ToggleableOutputPin for OutputOpenDrain<'d, T>
impl<'d, T: Pin> ToggleableOutputPin for OutputOpenDrain<'d, T>
Auto Trait Implementations§
impl<'d, T> Freeze for OutputOpenDrain<'d, T>where
T: Freeze,
impl<'d, T> RefUnwindSafe for OutputOpenDrain<'d, T>where
T: RefUnwindSafe,
impl<'d, T> Send for OutputOpenDrain<'d, T>where
T: Send,
impl<'d, T> Sync for OutputOpenDrain<'d, T>where
T: Sync,
impl<'d, T> Unpin for OutputOpenDrain<'d, T>where
T: Unpin,
impl<'d, T> !UnwindSafe for OutputOpenDrain<'d, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more