Struct rp_pico::Pins

source ·
pub struct Pins {
Show 30 fields pub gpio0: Pin<Gpio0, <Gpio0 as DefaultTypeState>::Function, <Gpio0 as DefaultTypeState>::PullType>, pub gpio1: Pin<Gpio1, <Gpio1 as DefaultTypeState>::Function, <Gpio1 as DefaultTypeState>::PullType>, pub gpio2: Pin<Gpio2, <Gpio2 as DefaultTypeState>::Function, <Gpio2 as DefaultTypeState>::PullType>, pub gpio3: Pin<Gpio3, <Gpio3 as DefaultTypeState>::Function, <Gpio3 as DefaultTypeState>::PullType>, pub gpio4: Pin<Gpio4, <Gpio4 as DefaultTypeState>::Function, <Gpio4 as DefaultTypeState>::PullType>, pub gpio5: Pin<Gpio5, <Gpio5 as DefaultTypeState>::Function, <Gpio5 as DefaultTypeState>::PullType>, pub gpio6: Pin<Gpio6, <Gpio6 as DefaultTypeState>::Function, <Gpio6 as DefaultTypeState>::PullType>, pub gpio7: Pin<Gpio7, <Gpio7 as DefaultTypeState>::Function, <Gpio7 as DefaultTypeState>::PullType>, pub gpio8: Pin<Gpio8, <Gpio8 as DefaultTypeState>::Function, <Gpio8 as DefaultTypeState>::PullType>, pub gpio9: Pin<Gpio9, <Gpio9 as DefaultTypeState>::Function, <Gpio9 as DefaultTypeState>::PullType>, pub gpio10: Pin<Gpio10, <Gpio10 as DefaultTypeState>::Function, <Gpio10 as DefaultTypeState>::PullType>, pub gpio11: Pin<Gpio11, <Gpio11 as DefaultTypeState>::Function, <Gpio11 as DefaultTypeState>::PullType>, pub gpio12: Pin<Gpio12, <Gpio12 as DefaultTypeState>::Function, <Gpio12 as DefaultTypeState>::PullType>, pub gpio13: Pin<Gpio13, <Gpio13 as DefaultTypeState>::Function, <Gpio13 as DefaultTypeState>::PullType>, pub gpio14: Pin<Gpio14, <Gpio14 as DefaultTypeState>::Function, <Gpio14 as DefaultTypeState>::PullType>, pub gpio15: Pin<Gpio15, <Gpio15 as DefaultTypeState>::Function, <Gpio15 as DefaultTypeState>::PullType>, pub gpio16: Pin<Gpio16, <Gpio16 as DefaultTypeState>::Function, <Gpio16 as DefaultTypeState>::PullType>, pub gpio17: Pin<Gpio17, <Gpio17 as DefaultTypeState>::Function, <Gpio17 as DefaultTypeState>::PullType>, pub gpio18: Pin<Gpio18, <Gpio18 as DefaultTypeState>::Function, <Gpio18 as DefaultTypeState>::PullType>, pub gpio19: Pin<Gpio19, <Gpio19 as DefaultTypeState>::Function, <Gpio19 as DefaultTypeState>::PullType>, pub gpio20: Pin<Gpio20, <Gpio20 as DefaultTypeState>::Function, <Gpio20 as DefaultTypeState>::PullType>, pub gpio21: Pin<Gpio21, <Gpio21 as DefaultTypeState>::Function, <Gpio21 as DefaultTypeState>::PullType>, pub gpio22: Pin<Gpio22, <Gpio22 as DefaultTypeState>::Function, <Gpio22 as DefaultTypeState>::PullType>, pub b_power_save: Pin<Gpio23, <Gpio23 as DefaultTypeState>::Function, <Gpio23 as DefaultTypeState>::PullType>, pub vbus_detect: Pin<Gpio24, <Gpio24 as DefaultTypeState>::Function, <Gpio24 as DefaultTypeState>::PullType>, pub led: Pin<Gpio25, <Gpio25 as DefaultTypeState>::Function, <Gpio25 as DefaultTypeState>::PullType>, pub gpio26: Pin<Gpio26, <Gpio26 as DefaultTypeState>::Function, <Gpio26 as DefaultTypeState>::PullType>, pub gpio27: Pin<Gpio27, <Gpio27 as DefaultTypeState>::Function, <Gpio27 as DefaultTypeState>::PullType>, pub gpio28: Pin<Gpio28, <Gpio28 as DefaultTypeState>::Function, <Gpio28 as DefaultTypeState>::PullType>, pub voltage_monitor: Pin<Gpio29, <Gpio29 as DefaultTypeState>::Function, <Gpio29 as DefaultTypeState>::PullType>,
}
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_function] function with one of:

like this:

 use rp2040_hal::{pac, gpio::{bank0::Gpio12, Pin, Pins}, 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_function::<rp2040_hal::gpio::FunctionSpi>();
 let _spi_mosi = pins.gpio3.into_function::<rp2040_hal::gpio::FunctionSpi>();
 let _spi_miso = pins.gpio4.into_function::<rp2040_hal::gpio::FunctionSpi>();

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

Fields§

§gpio0: Pin<Gpio0, <Gpio0 as DefaultTypeState>::Function, <Gpio0 as DefaultTypeState>::PullType>

GPIO 0 supports following functions:

FunctionAlias with applied function
SPI0 RXcrate::Gp0Spi0Rx
UART0 TXcrate::Gp0Uart0Tx
I2C0 SDAcrate::Gp0I2C0Sda
PWM0 Acrate::Gp0Pwm0A
PIO0crate::Gp0Pio0
PIO1crate::Gp0Pio1
§gpio1: Pin<Gpio1, <Gpio1 as DefaultTypeState>::Function, <Gpio1 as DefaultTypeState>::PullType>

GPIO 1 supports following functions:

FunctionAlias with applied function
SPI0 CSncrate::Gp1Spi0Csn
UART0 RXcrate::Gp1Uart0Rx
I2C0 SCLcrate::Gp1I2C0Scl
PWM0 Bcrate::Gp1Pwm0B
PIO0crate::Gp1Pio0
PIO1crate::Gp1Pio1
§gpio2: Pin<Gpio2, <Gpio2 as DefaultTypeState>::Function, <Gpio2 as DefaultTypeState>::PullType>

GPIO 2 supports following functions:

FunctionAlias with applied function
SPI0 SCKcrate::Gp2Spi0Sck
UART0 CTScrate::Gp2Uart0Cts
I2C1 SDAcrate::Gp2I2C1Sda
PWM1 Acrate::Gp2Pwm1A
PIO0crate::Gp2Pio0
PIO1crate::Gp2Pio1
§gpio3: Pin<Gpio3, <Gpio3 as DefaultTypeState>::Function, <Gpio3 as DefaultTypeState>::PullType>

GPIO 3 supports following functions:

FunctionAlias with applied function
SPI0 TXcrate::Gp3Spi0Tx
UART0 RTScrate::Gp3Uart0Rts
I2C1 SCLcrate::Gp3I2C1Scl
PWM1 Bcrate::Gp3Pwm1B
PIO0crate::Gp3Pio0
PIO1crate::Gp3Pio1
§gpio4: Pin<Gpio4, <Gpio4 as DefaultTypeState>::Function, <Gpio4 as DefaultTypeState>::PullType>

GPIO 4 supports following functions:

FunctionAlias with applied function
SPI0 RXcrate::Gp4Spi0Rx
UART1 TXcrate::Gp4Uart1Tx
I2C0 SDAcrate::Gp4I2C0Sda
PWM2 Acrate::Gp4Pwm2A
PIO0crate::Gp4Pio0
PIO1crate::Gp4Pio1
§gpio5: Pin<Gpio5, <Gpio5 as DefaultTypeState>::Function, <Gpio5 as DefaultTypeState>::PullType>

GPIO 5 supports following functions:

FunctionAlias with applied function
SPI0 CSncrate::Gp5Spi0Csn
UART1 RXcrate::Gp5Uart1Rx
I2C0 SCLcrate::Gp5I2C0Scl
PWM2 Bcrate::Gp5Pwm2B
PIO0crate::Gp5Pio0
PIO1crate::Gp5Pio1
§gpio6: Pin<Gpio6, <Gpio6 as DefaultTypeState>::Function, <Gpio6 as DefaultTypeState>::PullType>

GPIO 6 supports following functions:

FunctionAlias with applied function
SPI0 SCKcrate::Gp6Spi0Sck
UART1 CTScrate::Gp6Uart1Cts
I2C1 SDAcrate::Gp6I2C1Sda
PWM3 Acrate::Gp6Pwm3A
PIO0crate::Gp6Pio0
PIO1crate::Gp6Pio1
§gpio7: Pin<Gpio7, <Gpio7 as DefaultTypeState>::Function, <Gpio7 as DefaultTypeState>::PullType>

GPIO 7 supports following functions:

FunctionAlias with applied function
SPI0 TXcrate::Gp7Spi0Tx
UART1 RTScrate::Gp7Uart1Rts
I2C1 SCLcrate::Gp7I2C1Scl
PWM3 Bcrate::Gp7Pwm3B
PIO0crate::Gp7Pio0
PIO1crate::Gp7Pio1
§gpio8: Pin<Gpio8, <Gpio8 as DefaultTypeState>::Function, <Gpio8 as DefaultTypeState>::PullType>

GPIO 8 supports following functions:

FunctionAlias with applied function
SPI1 RXcrate::Gp8Spi1Rx
UART1 TXcrate::Gp8Uart1Tx
I2C0 SDAcrate::Gp8I2C0Sda
PWM4 Acrate::Gp8Pwm4A
PIO0crate::Gp8Pio0
PIO1crate::Gp8Pio1
§gpio9: Pin<Gpio9, <Gpio9 as DefaultTypeState>::Function, <Gpio9 as DefaultTypeState>::PullType>

GPIO 9 supports following functions:

FunctionAlias with applied function
SPI1 CSncrate::Gp9Spi1Csn
UART1 RXcrate::Gp9Uart1Rx
I2C0 SCLcrate::Gp9I2C0Scl
PWM4 Bcrate::Gp9Pwm4B
PIO0crate::Gp9Pio0
PIO1crate::Gp9Pio1
§gpio10: Pin<Gpio10, <Gpio10 as DefaultTypeState>::Function, <Gpio10 as DefaultTypeState>::PullType>

GPIO 10 supports following functions:

FunctionAlias with applied function
SPI1 SCKcrate::Gp10Spi1Sck
UART1 CTScrate::Gp10Uart1Cts
I2C1 SDAcrate::Gp10I2C1Sda
PWM5 Acrate::Gp10Pwm5A
PIO0crate::Gp10Pio0
PIO1crate::Gp10Pio1
§gpio11: Pin<Gpio11, <Gpio11 as DefaultTypeState>::Function, <Gpio11 as DefaultTypeState>::PullType>

GPIO 11 supports following functions:

FunctionAlias with applied function
SPI1 TXcrate::Gp11Spi1Tx
UART1 RTScrate::Gp11Uart1Rts
I2C1 SCLcrate::Gp11I2C1Scl
PWM5 Bcrate::Gp11Pwm5B
PIO0crate::Gp11Pio0
PIO1crate::Gp11Pio1
§gpio12: Pin<Gpio12, <Gpio12 as DefaultTypeState>::Function, <Gpio12 as DefaultTypeState>::PullType>

GPIO 12 supports following functions:

FunctionAlias with applied function
SPI1 RXcrate::Gp12Spi1Rx
UART0 TXcrate::Gp12Uart0Tx
I2C0 SDAcrate::Gp12I2C0Sda
PWM6 Acrate::Gp12Pwm6A
PIO0crate::Gp12Pio0
PIO1crate::Gp12Pio1
§gpio13: Pin<Gpio13, <Gpio13 as DefaultTypeState>::Function, <Gpio13 as DefaultTypeState>::PullType>

GPIO 13 supports following functions:

FunctionAlias with applied function
SPI1 CSncrate::Gp13Spi1Csn
UART0 RXcrate::Gp13Uart0Rx
I2C0 SCLcrate::Gp13I2C0Scl
PWM6 Bcrate::Gp13Pwm6B
PIO0crate::Gp13Pio0
PIO1crate::Gp13Pio1
§gpio14: Pin<Gpio14, <Gpio14 as DefaultTypeState>::Function, <Gpio14 as DefaultTypeState>::PullType>

GPIO 14 supports following functions:

FunctionAlias with applied function
SPI1 SCKcrate::Gp14Spi1Sck
UART0 CTScrate::Gp14Uart0Cts
I2C1 SDAcrate::Gp14I2C1Sda
PWM7 Acrate::Gp14Pwm7A
PIO0crate::Gp14Pio0
PIO1crate::Gp14Pio1
§gpio15: Pin<Gpio15, <Gpio15 as DefaultTypeState>::Function, <Gpio15 as DefaultTypeState>::PullType>

GPIO 15 supports following functions:

FunctionAlias with applied function
SPI1 TXcrate::Gp15Spi1Tx
UART0 RTScrate::Gp15Uart0Rts
I2C1 SCLcrate::Gp15I2C1Scl
PWM7 Bcrate::Gp15Pwm7B
PIO0crate::Gp15Pio0
PIO1crate::Gp15Pio1
§gpio16: Pin<Gpio16, <Gpio16 as DefaultTypeState>::Function, <Gpio16 as DefaultTypeState>::PullType>

GPIO 16 supports following functions:

FunctionAlias with applied function
SPI0 RXcrate::Gp16Spi0Rx
UART0 TXcrate::Gp16Uart0Tx
I2C0 SDAcrate::Gp16I2C0Sda
PWM0 Acrate::Gp16Pwm0A
PIO0crate::Gp16Pio0
PIO1crate::Gp16Pio1
§gpio17: Pin<Gpio17, <Gpio17 as DefaultTypeState>::Function, <Gpio17 as DefaultTypeState>::PullType>

GPIO 17 supports following functions:

FunctionAlias with applied function
SPI0 CSncrate::Gp17Spi0Csn
UART0 RXcrate::Gp17Uart0Rx
I2C0 SCLcrate::Gp17I2C0Scl
PWM0 Bcrate::Gp17Pwm0B
PIO0crate::Gp17Pio0
PIO1crate::Gp17Pio1
§gpio18: Pin<Gpio18, <Gpio18 as DefaultTypeState>::Function, <Gpio18 as DefaultTypeState>::PullType>

GPIO 18 supports following functions:

FunctionAlias with applied function
SPI0 SCKcrate::Gp18Spi0Sck
UART0 CTScrate::Gp18Uart0Cts
I2C1 SDAcrate::Gp18I2C1Sda
PWM1 Acrate::Gp18Pwm1A
PIO0crate::Gp18Pio0
PIO1crate::Gp18Pio1
§gpio19: Pin<Gpio19, <Gpio19 as DefaultTypeState>::Function, <Gpio19 as DefaultTypeState>::PullType>

GPIO 19 supports following functions:

FunctionAlias with applied function
SPI0 TXcrate::Gp19Spi0Tx
UART0 RTScrate::Gp19Uart0Rts
I2C1 SCLcrate::Gp19I2C1Scl
PWM1 Bcrate::Gp19Pwm1B
PIO0crate::Gp19Pio0
PIO1crate::Gp19Pio1
§gpio20: Pin<Gpio20, <Gpio20 as DefaultTypeState>::Function, <Gpio20 as DefaultTypeState>::PullType>

GPIO 20 supports following functions:

FunctionAlias with applied function
SPI0 RXcrate::Gp20Spi0Rx
UART1 TXcrate::Gp20Uart1Tx
I2C0 SDAcrate::Gp20I2C0Sda
PWM2 Acrate::Gp20Pwm2A
PIO0crate::Gp20Pio0
PIO1crate::Gp20Pio1
§gpio21: Pin<Gpio21, <Gpio21 as DefaultTypeState>::Function, <Gpio21 as DefaultTypeState>::PullType>

GPIO 21 supports following functions:

FunctionAlias with applied function
SPI0 CSncrate::Gp21Spi0Csn
UART1 RXcrate::Gp21Uart1Rx
I2C0 SCLcrate::Gp21I2C0Scl
PWM2 Bcrate::Gp21Pwm2B
PIO0crate::Gp21Pio0
PIO1crate::Gp21Pio1
§gpio22: Pin<Gpio22, <Gpio22 as DefaultTypeState>::Function, <Gpio22 as DefaultTypeState>::PullType>

GPIO 22 supports following functions:

FunctionAlias with applied function
SPI0 SCKcrate::Gp22Spi0Sck
UART1 CTScrate::Gp22Uart1Cts
I2C1 SDAcrate::Gp22I2C1Sda
PWM3 Acrate::Gp22Pwm3A
PIO0crate::Gp22Pio0
PIO1crate::Gp22Pio1
§b_power_save: Pin<Gpio23, <Gpio23 as DefaultTypeState>::Function, <Gpio23 as DefaultTypeState>::PullType>

GPIO 23 is connected to b_power_save of the Raspberry Pi Pico board.

§vbus_detect: Pin<Gpio24, <Gpio24 as DefaultTypeState>::Function, <Gpio24 as DefaultTypeState>::PullType>

GPIO 24 is connected to vbus_detect of the Raspberry Pi Pico board.

§led: Pin<Gpio25, <Gpio25 as DefaultTypeState>::Function, <Gpio25 as DefaultTypeState>::PullType>

GPIO 25 is connected to led of the Raspberry Pi Pico board.

§gpio26: Pin<Gpio26, <Gpio26 as DefaultTypeState>::Function, <Gpio26 as DefaultTypeState>::PullType>

GPIO 26 supports following functions:

FunctionAlias with applied function
SPI1 SCKcrate::Gp26Spi1Sck
UART1 CTScrate::Gp26Uart1Cts
I2C1 SDAcrate::Gp26I2C1Sda
PWM5 Acrate::Gp26Pwm5A
PIO0crate::Gp26Pio0
PIO1crate::Gp26Pio1
§gpio27: Pin<Gpio27, <Gpio27 as DefaultTypeState>::Function, <Gpio27 as DefaultTypeState>::PullType>

GPIO 27 supports following functions:

FunctionAlias with applied function
SPI1 TXcrate::Gp27Spi1Tx
UART1 RTScrate::Gp27Uart1Rts
I2C1 SCLcrate::Gp27I2C1Scl
PWM5 Bcrate::Gp27Pwm5B
PIO0crate::Gp27Pio0
PIO1crate::Gp27Pio1
§gpio28: Pin<Gpio28, <Gpio28 as DefaultTypeState>::Function, <Gpio28 as DefaultTypeState>::PullType>

GPIO 28 supports following functions:

FunctionAlias with applied function
SPI1 RXcrate::Gp28Spi1Rx
UART0 TXcrate::Gp28Uart0Tx
I2C0 SDAcrate::Gp28I2C0Sda
PWM6 Acrate::Gp28Pwm6A
PIO0crate::Gp28Pio0
PIO1crate::Gp28Pio1
§voltage_monitor: Pin<Gpio29, <Gpio29 as DefaultTypeState>::Function, <Gpio29 as DefaultTypeState>::PullType>

GPIO 29 is connected to voltage_monitor of the Raspberry Pi Pico board.

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 Freeze for Pins

§

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 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<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

source§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) 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, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

source§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.