Struct embassy_stm32::gpio::Output
source · pub struct Output<'d, T: Pin> { /* private fields */ }
Expand description
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
.
Implementations§
source§impl<'d, T: Pin> Output<'d, T>
impl<'d, T: Pin> Output<'d, T>
sourcepub fn new(
pin: impl Peripheral<P = T> + 'd,
initial_output: Level,
speed: Speed
) -> Self
pub fn new( pin: impl Peripheral<P = T> + 'd, initial_output: Level, speed: Speed ) -> 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
Is the output pin set as high?
sourcepub fn is_set_low(&self) -> bool
pub fn is_set_low(&self) -> bool
Is the output pin set as low?
sourcepub fn get_output_level(&self) -> Level
pub fn get_output_level(&self) -> Level
What level output is set to
Trait Implementations§
source§impl<'d, T: Pin> StatefulOutputPin for Output<'d, T>
impl<'d, T: Pin> StatefulOutputPin for Output<'d, T>
source§impl<'d, T: Pin> StatefulOutputPin for Output<'d, T>
impl<'d, T: Pin> StatefulOutputPin for Output<'d, T>
Auto Trait Implementations§
impl<'d, T> Freeze for Output<'d, T>where
T: Freeze,
impl<'d, T> RefUnwindSafe for Output<'d, T>where
T: RefUnwindSafe,
impl<'d, T> Send for Output<'d, T>where
T: Send,
impl<'d, T> Sync for Output<'d, T>where
T: Sync,
impl<'d, T> Unpin for Output<'d, T>where
T: Unpin,
impl<'d, T> !UnwindSafe for Output<'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