pub struct OutputOpenDrain<'d> { /* private fields */ }Expand description
GPIO output open-drain driver.
The pin drives the line low when set low and leaves it floating (disconnected) when set
high, so the line can be shared with other open-drain devices (wired-and). The input buffer
stays connected, so the actual line level can be read back with is_high and
friends.
Implementations§
Source§impl<'d> OutputOpenDrain<'d>
impl<'d> OutputOpenDrain<'d>
Sourcepub fn new(
pin: Peri<'d, impl Pin>,
initial_output: Level,
drive: OutputDrive,
pull: Pull,
) -> Self
pub fn new( pin: Peri<'d, impl Pin>, initial_output: Level, drive: OutputDrive, pull: Pull, ) -> Self
Create GPIO output open-drain driver for a Pin with the provided Level, OutputDrive and Pull configuration.
drive selects the drive strength used when driving the line low. It should be one of the
*Disconnect1 variants (typically OutputDrive::Standard0Disconnect1), otherwise the pin
will actively drive the line high as well.
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 output_level(&self) -> Level
pub fn output_level(&self) -> Level
Get the current output level.
Source§impl OutputOpenDrain<'static>
impl OutputOpenDrain<'static>
Sourcepub fn persist(self)
pub fn persist(self)
Persist the pin’s configuration for the rest of the program’s lifetime. This method should
be preferred over core::mem::forget() because the 'static bound prevents accidental
reuse of the underlying peripheral.
Source§impl<'d> OutputOpenDrain<'d>
impl<'d> OutputOpenDrain<'d>
Sourcepub async fn wait_for_high(&mut self)
pub async fn wait_for_high(&mut self)
Wait until the pin is high. If it is already high, return immediately.
Sourcepub async fn wait_for_low(&mut self)
pub async fn wait_for_low(&mut self)
Wait until the pin is low. If it is already low, return immediately.
Sourcepub async fn wait_for_rising_edge(&mut self)
pub async fn wait_for_rising_edge(&mut self)
Wait for the pin to undergo a transition from low to high.
Sourcepub async fn wait_for_falling_edge(&mut self)
pub async fn wait_for_falling_edge(&mut self)
Wait for the pin to undergo a transition from high to low.
Sourcepub async fn wait_for_any_edge(&mut self)
pub async fn wait_for_any_edge(&mut self)
Wait for the pin to undergo any transition, i.e low to high OR high to low.