pub struct Flex<'d> { /* private fields */ }Expand description
GPIO flexible pin.
This pin can either be a disconnected, input, or output pin, or both. The 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: Peri<'d, impl Pin>) -> Self
pub fn new(pin: Peri<'d, impl Pin>) -> 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_as_input(&mut self, pull: Pull)
pub fn set_as_input(&mut self, pull: Pull)
Put the pin into input mode.
Sourcepub fn set_as_output(&mut self, speed: Speed)
pub fn set_as_output(&mut self, speed: Speed)
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 set_as_output_open_drain(&mut self, speed: Speed)
pub fn set_as_output_open_drain(&mut self, speed: Speed)
Put the pin into output mode with open drain.
Pull resistor is disabled in this mode.
pub fn is_high(&self) -> bool
pub fn is_low(&self) -> bool
pub fn get_level(&self) -> Level
pub fn is_set_high(&self) -> bool
Sourcepub fn is_set_low(&self) -> bool
pub fn is_set_low(&self) -> bool
Is the output pin set as low?
Sourcepub fn get_output_level(&self) -> Level
pub fn get_output_level(&self) -> Level
What level output is set to
pub fn set_high(&mut self)
pub fn set_level(&mut self, level: Level)
Trait Implementations§
Source§impl<'d> StatefulOutputPin for Flex<'d>
impl<'d> StatefulOutputPin for Flex<'d>
Source§fn is_set_low(&mut self) -> Result<bool, Self::Error>
fn is_set_low(&mut self) -> Result<bool, Self::Error>
Is the output pin set as low?