pub struct Flex<'d, P = AnyPin> { /* private fields */ }Expand description
Flexible pin driver.
This driver allows changing the pin mode between input and output.
Implementations§
Source§impl<P> Flex<'_, P>where
P: InputPin,
impl<P> Flex<'_, P>where
P: InputPin,
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, P> Flex<'d, P>where
P: Pin,
impl<'d, P> Flex<'d, P>where
P: Pin,
Sourcepub fn new_typed(pin: impl Peripheral<P = P> + 'd) -> Self
pub fn new_typed(pin: impl Peripheral<P = P> + 'd) -> Self
Create flexible pin driver for a Pin. No mode change happens.
Sourcepub fn peripheral_input(&self) -> InputSignal
pub fn peripheral_input(&self) -> InputSignal
Returns a peripheral input connected to this pin.
The input signal can be passed to peripherals in place of an input pin.
Source§impl<P> Flex<'_, P>where
P: InputPin,
impl<P> Flex<'_, P>where
P: InputPin,
Sourcepub fn set_as_input(&mut self, pull: Pull)
pub fn set_as_input(&mut self, pull: Pull)
Set the GPIO to input mode.
Sourcepub fn clear_interrupt(&mut self)
pub fn clear_interrupt(&mut self)
Clear the interrupt status bit for this Pin
Sourcepub fn is_interrupt_set(&self) -> bool
pub fn is_interrupt_set(&self) -> bool
Checks if the interrupt status bit for this Pin is set
Sourcepub fn wakeup_enable(&mut self, enable: bool, event: WakeEvent)
pub fn wakeup_enable(&mut self, enable: bool, event: WakeEvent)
Enable as a wake-up source.
This will unlisten for interrupts
Source§impl<P> Flex<'_, P>where
P: OutputPin,
impl<P> Flex<'_, P>where
P: OutputPin,
Sourcepub fn set_as_output(&mut self)
pub fn set_as_output(&mut self)
Set the GPIO to output mode.
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 output_level(&self) -> Level
pub fn output_level(&self) -> Level
What level output is set to
Sourcepub fn set_drive_strength(&mut self, strength: DriveStrength)
pub fn set_drive_strength(&mut self, strength: DriveStrength)
Configure the DriveStrength of the pin
Sourcepub fn set_as_open_drain(&mut self, pull: Pull)
pub fn set_as_open_drain(&mut self, pull: Pull)
Set the GPIO to open-drain mode.
Sourcepub fn split(self) -> (InputSignal, OutputSignal)
pub fn split(self) -> (InputSignal, OutputSignal)
Split the pin into an input and output signal.
Peripheral signals allow connecting peripherals together without using external hardware.
Sourcepub fn into_peripheral_output(self) -> OutputSignal
pub fn into_peripheral_output(self) -> OutputSignal
Turns the pin object into a peripheral output.
The output signal can be passed to peripherals in place of an output pin.