pub struct Flex<'d> { /* private fields */ }Expand description
A flexible pin that can be configured as input or output.
Implementations§
Source§impl<'d> Flex<'d>
impl<'d> Flex<'d>
Sourcepub fn new(pin: Peri<'d, impl GpioPin>) -> Self
pub fn new(pin: Peri<'d, impl GpioPin>) -> Self
Wrap the pin in a Flex.
The pin remains unmodified. The initial output level is unspecified, but can be changed before the pin is put into output mode.
Sourcepub fn set_as_input(&mut self)
pub fn set_as_input(&mut self)
Put the pin into input mode.
Sourcepub fn set_as_output(&mut self)
pub fn set_as_output(&mut self)
Put the pin into 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 set_drive_strength(&mut self, strength: DriveStrength)
pub fn set_drive_strength(&mut self, strength: DriveStrength)
Configure the pin drive strength.
Sourcepub fn set_slew_rate(&mut self, slew_rate: SlewRate)
pub fn set_slew_rate(&mut self, slew_rate: SlewRate)
Configure the pin slew rate.
Sourcepub fn set_enable_input_buffer(&mut self)
pub fn set_enable_input_buffer(&mut self)
Enable input buffer for the pin.
Source§impl<'d> Flex<'d>
Async methods
impl<'d> Flex<'d>
Async methods
Sourcepub fn wait_for_high(&mut self) -> impl Future<Output = ()> + use<'_, 'd>
pub fn wait_for_high(&mut self) -> impl Future<Output = ()> + use<'_, 'd>
Wait until the pin is high. If it is already high, return immediately.
Sourcepub fn wait_for_low(&mut self) -> impl Future<Output = ()> + use<'_, 'd>
pub fn wait_for_low(&mut self) -> impl Future<Output = ()> + use<'_, 'd>
Wait until the pin is low. If it is already low, return immediately.
Sourcepub fn wait_for_rising_edge(&mut self) -> impl Future<Output = ()> + use<'_, 'd>
pub fn wait_for_rising_edge(&mut self) -> impl Future<Output = ()> + use<'_, 'd>
Wait for the pin to undergo a transition from low to high.
Sourcepub fn wait_for_falling_edge(
&mut self,
) -> impl Future<Output = ()> + use<'_, 'd>
pub fn wait_for_falling_edge( &mut self, ) -> impl Future<Output = ()> + use<'_, 'd>
Wait for the pin to undergo a transition from high to low.
Sourcepub fn wait_for_any_edge(&mut self) -> impl Future<Output = ()> + use<'_, 'd>
pub fn wait_for_any_edge(&mut self) -> impl Future<Output = ()> + use<'_, 'd>
Wait for the pin to undergo any transition, i.e low to high OR high to low.