pub struct Flex<'d> { /* private fields */ }
Expand description
GPIO flexible pin.
This pin can be either an input or output pin. The output level register bit will remain set while not in output mode, so the pin’s level will be ‘remembered’ when it is not in output mode.
Implementations§
Source§impl<'d> Flex<'d>
impl<'d> Flex<'d>
Sourcepub fn new(pin: impl Peripheral<P = impl Pin> + 'd) -> Self
pub fn new(pin: impl Peripheral<P = impl Pin> + 'd) -> Self
Wrap the pin in a Flex
.
The pin remains disconnected. The initial output level is unspecified, but can be changed before the pin is put into output mode.
Sourcepub fn set_drive_strength(&mut self, strength: Drive)
pub fn set_drive_strength(&mut self, strength: Drive)
Set the pin’s drive strength.
Sourcepub fn set_slew_rate(&mut self, slew_rate: SlewRate)
pub fn set_slew_rate(&mut self, slew_rate: SlewRate)
Set the pin’s slew rate.
Sourcepub fn set_schmitt(&mut self, enable: bool)
pub fn set_schmitt(&mut self, enable: bool)
Set the pin’s Schmitt trigger.
Sourcepub fn set_as_input(&mut self)
pub fn set_as_input(&mut self)
Put the pin into input mode.
The pull setting is left unchanged.
Sourcepub fn set_as_output(&mut self)
pub fn set_as_output(&mut self)
Put the pin into output mode.
The pin level will be whatever was set before (or low by default). If you want it to begin
at a specific level, call set_high
/set_low
on the pin first.
Sourcepub fn toggle_set_as_output(&mut self)
pub fn toggle_set_as_output(&mut self)
Toggle output pin.
Sourcepub fn is_set_high(&self) -> bool
pub fn is_set_high(&self) -> bool
Is the output level high?
Sourcepub fn is_set_low(&self) -> bool
pub fn is_set_low(&self) -> bool
Is the output level low?
Sourcepub fn get_output_level(&self) -> Level
pub fn get_output_level(&self) -> Level
What level output is set to
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.
Sourcepub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<'_>
pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<'_>
Configure dormant wake.