Struct AnyPin

Source
pub struct AnyPin<'lt> { /* private fields */ }
Expand description

Any GPIO pin.

Implementations§

Source§

impl<'lt> AnyPin<'lt>

Source

pub unsafe fn split(self) -> (InputSignal<'lt>, OutputSignal<'lt>)

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.

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.

Source

pub unsafe fn into_input_signal(self) -> InputSignal<'lt>

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.

Source

pub fn into_output_signal(self) -> OutputSignal<'lt>

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.

Source§

impl AnyPin<'_>

Source

pub unsafe fn steal(pin: u8) -> Self

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.

Source

pub unsafe fn clone_unchecked(&self) -> Self

Unsafely clone the pin.

§Safety

Ensure that only one instance of a pin is in use at one time.

Source

pub fn reborrow(&mut self) -> AnyPin<'_>

Create a new AnyPin object that is limited to the lifetime of the passed reference.

Trait Implementations§

Source§

impl<'lt> Debug for AnyPin<'lt>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'lt> From<GPIO0<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO0<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO1<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO1<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO10<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO10<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO11<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO11<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO12<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO12<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO13<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO13<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO14<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO14<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO15<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO15<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO16<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO16<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO17<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO17<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO18<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO18<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO19<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO19<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO2<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO2<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO20<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO20<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO21<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO21<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO22<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO22<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO23<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO23<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO24<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO24<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO25<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO25<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO26<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO26<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO27<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO27<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO28<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO28<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO29<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO29<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO3<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO3<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO30<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO30<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO4<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO4<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO5<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO5<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO6<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO6<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO7<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO7<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO8<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO8<'lt>) -> Self

Converts to this type from the input type.
Source§

impl<'lt> From<GPIO9<'lt>> for AnyPin<'lt>

Source§

fn from(pin: GPIO9<'lt>) -> Self

Converts to this type from the input type.
Source§

impl Pin for AnyPin<'_>

Source§

fn number(&self) -> u8

GPIO number
Source§

fn degrade<'d>(self) -> AnyPin<'d>
where Self: Sized + 'd,

Type-erase this pin into an AnyPin. Read more
Source§

impl InputPin for AnyPin<'_>

Source§

impl OutputPin for AnyPin<'_>

Source§

impl RtcPin for AnyPin<'_>

Source§

impl RtcPinWithResistors for AnyPin<'_>

Auto Trait Implementations§

§

impl<'lt> Freeze for AnyPin<'lt>

§

impl<'lt> RefUnwindSafe for AnyPin<'lt>

§

impl<'lt> Send for AnyPin<'lt>

§

impl<'lt> Sync for AnyPin<'lt>

§

impl<'lt> Unpin for AnyPin<'lt>

§

impl<'lt> !UnwindSafe for AnyPin<'lt>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

Source§

impl<'d, P> PeripheralOutput<'d> for P
where P: OutputPin + 'd,

Source§

impl<'d, P> PeripheralSignal<'d> for P
where P: Pin + 'd,

Source§

fn connect_input_to_peripheral(&self, signal: InputSignal)

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'d, P> PeripheralInput<'d> for P
where P: InputPin + 'd,