Skip to main content

AnyPin

Struct AnyPin 

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

A type-erased pin that can represent any GPIO pin.

Implementations§

Source§

impl<'d> AnyPin<'d>

Source

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

Create an AnyPin from a raw pin number without checking.

§Safety

The pin must be valid (0-18). This bypasses the type system.

Source

pub fn number(&self) -> u8

Get the pin number (0-18).

Source

pub fn init_input(self, config: InputConfig) -> Input<'d>

Initialize this pin as a GPIO input.

Applies config.pull to the pad via the IO_CONFIG pad register (apply_pull; pins 0..=14 have a pad-control register).

Source

pub fn init_output(self, config: OutputConfig) -> Output<'d>

Initialize this pin as a GPIO output.

Source

pub fn init_flex(self, config: OutputConfig) -> Flex<'d>

Initialize this pin as a Flex (combined input/output) driver.

Auto Trait Implementations§

§

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

§

impl<'d> Freeze for AnyPin<'d>

§

impl<'d> RefUnwindSafe for AnyPin<'d>

§

impl<'d> Send for AnyPin<'d>

§

impl<'d> Sync for AnyPin<'d>

§

impl<'d> Unpin for AnyPin<'d>

§

impl<'d> UnsafeUnpin for AnyPin<'d>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.