pub struct Pin { /* private fields */ }Expand description
Unconfigured GPIO pin.
Pins are constructed by retrieving them using Gpio::get.
An unconfigured Pin can be used to read the pin’s mode and logic level.
Converting the Pin to an InputPin, OutputPin or IoPin through the
various into_ methods available on Pin configures the appropriate mode, and
provides access to additional methods relevant to the selected pin mode.
The unproven embedded-hal digital::InputPin trait implementation for Pin can be enabled
by specifying the optional hal-unproven feature in the dependency declaration for
the rppal crate.
Implementations§
source§impl Pin
impl Pin
sourcepub fn pin(&self) -> u8
pub fn pin(&self) -> u8
Returns the GPIO pin number.
Pins are addressed by their BCM GPIO numbers, rather than their physical location.
sourcepub fn into_input(self) -> InputPin
pub fn into_input(self) -> InputPin
sourcepub fn into_input_pulldown(self) -> InputPin
pub fn into_input_pulldown(self) -> InputPin
Consumes the Pin and returns an InputPin. Sets the mode to Input
and enables the pin’s built-in pull-down resistor.
The pull-down resistor is disabled when InputPin goes out of scope if reset_on_drop
is set to true (default).
sourcepub fn into_input_pullup(self) -> InputPin
pub fn into_input_pullup(self) -> InputPin
Consumes the Pin and returns an InputPin. Sets the mode to Input
and enables the pin’s built-in pull-up resistor.
The pull-up resistor is disabled when InputPin goes out of scope if reset_on_drop
is set to true (default).
sourcepub fn into_output(self) -> OutputPin
pub fn into_output(self) -> OutputPin
Consumes the Pin and returns an OutputPin. Sets the mode to Mode::Output
and leaves the logic level unchanged.
sourcepub fn into_output_low(self) -> OutputPin
pub fn into_output_low(self) -> OutputPin
Consumes the Pin and returns an OutputPin. Changes the logic level to
Level::Low and then sets the mode to Mode::Output.
sourcepub fn into_output_high(self) -> OutputPin
pub fn into_output_high(self) -> OutputPin
Consumes the Pin and returns an OutputPin. Changes the logic level to
Level::High and then sets the mode to Mode::Output.