Struct AnyPin Copy item path Source pub struct AnyPin<'lt> { }
Expand description Available on crate feature unstable
only.
Split the pin into an input and output signal.
Peripheral signals allow connecting peripherals together without
using external hardware.
Creating an input signal enables the pin’s input buffer.
§ Safety
The caller must ensure that peripheral drivers don’t configure the same
GPIO at the same time in multiple places. This includes clones of the
InputSignal
struct, as well as the OutputSignal
struct.
§ Panics
This function panics if the pin is not an output pin.
§ Example
use esp_hal::gpio::{AnyPin, Pin};
let pin1 = peripherals.GPIO1.degrade();
let (input, output) = unsafe { pin1.split() };
§ Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Available on crate feature unstable
only.
Convert the pin into an input signal.
Peripheral signals allow connecting peripherals together without
using external hardware.
Creating an input signal enables the pin’s input buffer.
§ Safety
The caller must ensure that peripheral drivers don’t configure the same
GPIO at the same time in multiple places. This includes clones of the
InputSignal
struct.
§ Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Available on crate feature unstable
only.
Convert the pin into an output signal.
Peripheral signals allow connecting peripherals together without
using external hardware.
§ Panics
This function panics if the pin is not an output pin.
§ Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Attempts to downcast the pin into the underlying GPIO instance.
§ Example
use esp_hal::{
gpio::AnyPin,
peripherals::{GPIO2, GPIO4},
};
let any_pin2 = AnyPin::from(peripherals.GPIO2);
let any_pin3 = AnyPin::from(peripherals.GPIO3);
let gpio2 = any_pin2
.downcast::<GPIO2>()
.expect("This downcast succeeds because AnyPin was created from GPIO2" );
let gpio4 = any_pin3
.downcast::<GPIO4>()
.expect_err("This AnyPin was created from GPIO3, it cannot be downcast to GPIO4" );
Conjure a new GPIO pin out of thin air.
§ Safety
The caller must ensure that only one instance of a pin is in use at one time.
§ Panics
Panics if the pin with the given number does not exist.
§ Example
use esp_hal::gpio::AnyPin;
let pin = unsafe { AnyPin::steal(1 ) };
Unsafely clone the pin.
§ Safety
Ensure that only one instance of a pin is in use at one time.
§ Example
use esp_hal::gpio::{AnyPin, Pin};
let pin = peripherals.GPIO1.degrade();
let pin_cloned = unsafe { pin.clone_unchecked() };
Create a new AnyPin object that is limited to the lifetime of the
passed reference.
§ Example
use esp_hal::gpio::{AnyPin, Pin};
let mut pin = peripherals.GPIO1.degrade();
let pin_reborrowed = pin.reborrow();
Formats the value using the given formatter.
Read more Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
[From]<T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.