pub struct OutputOpenDrain<'d, M: Mode = Blocking> { /* 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, Blocking>
impl<'d> OutputOpenDrain<'d, Blocking>
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 a blocking 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.
Source§impl<'d> OutputOpenDrain<'d, Async>
impl<'d> OutputOpenDrain<'d, Async>
Sourcepub fn new_async<T: GpiotePin>(
pin: Peri<'d, T>,
irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
initial_output: Level,
drive: OutputDrive,
pull: Pull,
) -> Self
pub fn new_async<T: GpiotePin>( pin: Peri<'d, T>, irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, initial_output: Level, drive: OutputDrive, pull: Pull, ) -> Self
Create an async GPIO output open-drain driver for a Pin with the provided Level, OutputDrive and Pull configuration.
The pin’s GPIOTE interrupt must be bound to InterruptHandler for this pin.
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 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.
Source§impl<'d, M: Mode> OutputOpenDrain<'d, M>
impl<'d, M: Mode> OutputOpenDrain<'d, M>
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.