Struct boardsource_blok::Pins

source ·
pub struct Pins {
Show 19 fields pub tx: Pin<Gpio0, <Gpio0 as PinId>::Reset>, pub rx: Pin<Gpio1, <Gpio1 as PinId>::Reset>, pub sda: Pin<Gpio16, <Gpio16 as PinId>::Reset>, pub scl: Pin<Gpio17, <Gpio17 as PinId>::Reset>, pub gpio4: Pin<Gpio4, <Gpio4 as PinId>::Reset>, pub gpio5: Pin<Gpio5, <Gpio5 as PinId>::Reset>, pub gpio6: Pin<Gpio6, <Gpio6 as PinId>::Reset>, pub gpio7: Pin<Gpio7, <Gpio7 as PinId>::Reset>, pub gpio8: Pin<Gpio8, <Gpio8 as PinId>::Reset>, pub gpio9: Pin<Gpio9, <Gpio9 as PinId>::Reset>, pub gpio29: Pin<Gpio29, <Gpio29 as PinId>::Reset>, pub gpio28: Pin<Gpio28, <Gpio28 as PinId>::Reset>, pub gpio27: Pin<Gpio27, <Gpio27 as PinId>::Reset>, pub gpio26: Pin<Gpio26, <Gpio26 as PinId>::Reset>, pub gpio22: Pin<Gpio22, <Gpio22 as PinId>::Reset>, pub gpio20: Pin<Gpio20, <Gpio20 as PinId>::Reset>, pub gpio23: Pin<Gpio23, <Gpio23 as PinId>::Reset>, pub gpio21: Pin<Gpio21, <Gpio21 as PinId>::Reset>, pub neopixel: Pin<Gpio25, <Gpio25 as PinId>::Reset>,
}
Expand description

BSP replacement for the HAL Pins type

This type is intended to provide more meaningful names for the given pins.

To enable specific functions of the pins you can use the rp2040_hal::gpio::pin::Pin::into_mode function with one of:

like this:

 use rp2040_hal::{pac, gpio::{bank0::Gpio12, Pin, Pins, PushPullOutput}, sio::Sio};

 let mut peripherals = pac::Peripherals::take().unwrap();
 let sio = Sio::new(peripherals.SIO);
 let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS);

 let _spi_sclk = pins.gpio2.into_mode::<rp2040_hal::gpio::FunctionSpi>();
 let _spi_mosi = pins.gpio3.into_mode::<rp2040_hal::gpio::FunctionSpi>();
 let _spi_miso = pins.gpio4.into_mode::<rp2040_hal::gpio::FunctionSpi>();

See also rp2040_hal::gpio::pin for more in depth information about this!

Fields§

§tx: Pin<Gpio0, <Gpio0 as PinId>::Reset>§rx: Pin<Gpio1, <Gpio1 as PinId>::Reset>§sda: Pin<Gpio16, <Gpio16 as PinId>::Reset>§scl: Pin<Gpio17, <Gpio17 as PinId>::Reset>§gpio4: Pin<Gpio4, <Gpio4 as PinId>::Reset>§gpio5: Pin<Gpio5, <Gpio5 as PinId>::Reset>§gpio6: Pin<Gpio6, <Gpio6 as PinId>::Reset>§gpio7: Pin<Gpio7, <Gpio7 as PinId>::Reset>§gpio8: Pin<Gpio8, <Gpio8 as PinId>::Reset>§gpio9: Pin<Gpio9, <Gpio9 as PinId>::Reset>§gpio29: Pin<Gpio29, <Gpio29 as PinId>::Reset>§gpio28: Pin<Gpio28, <Gpio28 as PinId>::Reset>§gpio27: Pin<Gpio27, <Gpio27 as PinId>::Reset>§gpio26: Pin<Gpio26, <Gpio26 as PinId>::Reset>§gpio22: Pin<Gpio22, <Gpio22 as PinId>::Reset>§gpio20: Pin<Gpio20, <Gpio20 as PinId>::Reset>§gpio23: Pin<Gpio23, <Gpio23 as PinId>::Reset>§gpio21: Pin<Gpio21, <Gpio21 as PinId>::Reset>§neopixel: Pin<Gpio25, <Gpio25 as PinId>::Reset>

Implementations§

source§

impl Pins

source

pub fn new( io: IO_BANK0, pads: PADS_BANK0, sio: SioGpioBank0, reset: &mut RESETS ) -> Self

Take ownership of the PAC [PORT] and split it into discrete [Pin]s.

This struct serves as a replacement for the HAL Pins struct. It is intended to provide more meaningful names for each [Pin] in a BSP. Any [Pin] not defined by the BSP is dropped.

Pin Pins

Auto Trait Implementations§

§

impl RefUnwindSafe for Pins

§

impl Send for Pins

§

impl Sync for Pins

§

impl Unpin for Pins

§

impl UnwindSafe for Pins

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.