pub struct Pins {Show 19 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 gpio16: Pin<Gpio16, <Gpio16 as DefaultTypeState>::Function, <Gpio16 as DefaultTypeState>::PullType>,
pub gpio17: Pin<Gpio17, <Gpio17 as DefaultTypeState>::Function, <Gpio17 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 gpio29: Pin<Gpio29, <Gpio29 as DefaultTypeState>::Function, <Gpio29 as DefaultTypeState>::PullType>,
pub gpio28: Pin<Gpio28, <Gpio28 as DefaultTypeState>::Function, <Gpio28 as DefaultTypeState>::PullType>,
pub gpio27: Pin<Gpio27, <Gpio27 as DefaultTypeState>::Function, <Gpio27 as DefaultTypeState>::PullType>,
pub gpio26: Pin<Gpio26, <Gpio26 as DefaultTypeState>::Function, <Gpio26 as DefaultTypeState>::PullType>,
pub gpio22: Pin<Gpio22, <Gpio22 as DefaultTypeState>::Function, <Gpio22 as DefaultTypeState>::PullType>,
pub gpio20: Pin<Gpio20, <Gpio20 as DefaultTypeState>::Function, <Gpio20 as DefaultTypeState>::PullType>,
pub gpio23: Pin<Gpio23, <Gpio23 as DefaultTypeState>::Function, <Gpio23 as DefaultTypeState>::PullType>,
pub gpio21: Pin<Gpio21, <Gpio21 as DefaultTypeState>::Function, <Gpio21 as DefaultTypeState>::PullType>,
pub neopixel: Pin<Gpio25, <Gpio25 as DefaultTypeState>::Function, <Gpio25 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:
- rp2040_hal::gpio::FunctionI2C
- rp2040_hal::gpio::FunctionPwm
- rp2040_hal::gpio::FunctionSpi
- rp2040_hal::gpio::FunctionXip
- rp2040_hal::gpio::FunctionPio0
- rp2040_hal::gpio::FunctionPio1
- rp2040_hal::gpio::FunctionUart
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:
Function | Alias with applied function |
---|---|
SPI0 RX | crate::Gp0Spi0Rx |
UART0 TX | crate::Gp0Uart0Tx |
I2C0 SDA | crate::Gp0I2C0Sda |
PWM0 A | crate::Gp0Pwm0A |
PIO0 | crate::Gp0Pio0 |
PIO1 | crate::Gp0Pio1 |
gpio1: Pin<Gpio1, <Gpio1 as DefaultTypeState>::Function, <Gpio1 as DefaultTypeState>::PullType>
GPIO 1 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 CSn | crate::Gp1Spi0Csn |
UART0 RX | crate::Gp1Uart0Rx |
I2C0 SCL | crate::Gp1I2C0Scl |
PWM0 B | crate::Gp1Pwm0B |
PIO0 | crate::Gp1Pio0 |
PIO1 | crate::Gp1Pio1 |
gpio16: Pin<Gpio16, <Gpio16 as DefaultTypeState>::Function, <Gpio16 as DefaultTypeState>::PullType>
GPIO 16 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 RX | crate::Gp16Spi0Rx |
UART0 TX | crate::Gp16Uart0Tx |
I2C0 SDA | crate::Gp16I2C0Sda |
PWM0 A | crate::Gp16Pwm0A |
PIO0 | crate::Gp16Pio0 |
PIO1 | crate::Gp16Pio1 |
gpio17: Pin<Gpio17, <Gpio17 as DefaultTypeState>::Function, <Gpio17 as DefaultTypeState>::PullType>
GPIO 17 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 CSn | crate::Gp17Spi0Csn |
UART0 RX | crate::Gp17Uart0Rx |
I2C0 SCL | crate::Gp17I2C0Scl |
PWM0 B | crate::Gp17Pwm0B |
PIO0 | crate::Gp17Pio0 |
PIO1 | crate::Gp17Pio1 |
gpio4: Pin<Gpio4, <Gpio4 as DefaultTypeState>::Function, <Gpio4 as DefaultTypeState>::PullType>
GPIO 4 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 RX | crate::Gp4Spi0Rx |
UART1 TX | crate::Gp4Uart1Tx |
I2C0 SDA | crate::Gp4I2C0Sda |
PWM2 A | crate::Gp4Pwm2A |
PIO0 | crate::Gp4Pio0 |
PIO1 | crate::Gp4Pio1 |
gpio5: Pin<Gpio5, <Gpio5 as DefaultTypeState>::Function, <Gpio5 as DefaultTypeState>::PullType>
GPIO 5 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 CSn | crate::Gp5Spi0Csn |
UART1 RX | crate::Gp5Uart1Rx |
I2C0 SCL | crate::Gp5I2C0Scl |
PWM2 B | crate::Gp5Pwm2B |
PIO0 | crate::Gp5Pio0 |
PIO1 | crate::Gp5Pio1 |
gpio6: Pin<Gpio6, <Gpio6 as DefaultTypeState>::Function, <Gpio6 as DefaultTypeState>::PullType>
GPIO 6 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 SCK | crate::Gp6Spi0Sck |
UART1 CTS | crate::Gp6Uart1Cts |
I2C1 SDA | crate::Gp6I2C1Sda |
PWM3 A | crate::Gp6Pwm3A |
PIO0 | crate::Gp6Pio0 |
PIO1 | crate::Gp6Pio1 |
gpio7: Pin<Gpio7, <Gpio7 as DefaultTypeState>::Function, <Gpio7 as DefaultTypeState>::PullType>
GPIO 7 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 TX | crate::Gp7Spi0Tx |
UART1 RTS | crate::Gp7Uart1Rts |
I2C1 SCL | crate::Gp7I2C1Scl |
PWM3 B | crate::Gp7Pwm3B |
PIO0 | crate::Gp7Pio0 |
PIO1 | crate::Gp7Pio1 |
gpio8: Pin<Gpio8, <Gpio8 as DefaultTypeState>::Function, <Gpio8 as DefaultTypeState>::PullType>
GPIO 8 supports following functions:
Function | Alias with applied function |
---|---|
SPI1 RX | crate::Gp8Spi1Rx |
UART1 TX | crate::Gp8Uart1Tx |
I2C0 SDA | crate::Gp8I2C0Sda |
PWM4 A | crate::Gp8Pwm4A |
PIO0 | crate::Gp8Pio0 |
PIO1 | crate::Gp8Pio1 |
gpio9: Pin<Gpio9, <Gpio9 as DefaultTypeState>::Function, <Gpio9 as DefaultTypeState>::PullType>
GPIO 9 supports following functions:
Function | Alias with applied function |
---|---|
SPI1 CSn | crate::Gp9Spi1Csn |
UART1 RX | crate::Gp9Uart1Rx |
I2C0 SCL | crate::Gp9I2C0Scl |
PWM4 B | crate::Gp9Pwm4B |
PIO0 | crate::Gp9Pio0 |
PIO1 | crate::Gp9Pio1 |
gpio29: Pin<Gpio29, <Gpio29 as DefaultTypeState>::Function, <Gpio29 as DefaultTypeState>::PullType>
GPIO 29 supports following functions:
Function | Alias with applied function |
---|---|
SPI1 CSn | crate::Gp29Spi1Csn |
UART0 RX | crate::Gp29Uart0Rx |
I2C0 SCL | crate::Gp29I2C0Scl |
PWM4 B | crate::Gp29Pwm6B |
PIO0 | crate::Gp29Pio0 |
PIO1 | crate::Gp29Pio1 |
gpio28: Pin<Gpio28, <Gpio28 as DefaultTypeState>::Function, <Gpio28 as DefaultTypeState>::PullType>
GPIO 28 supports following functions:
Function | Alias with applied function |
---|---|
SPI1 RX | crate::Gp28Spi1Rx |
UART0 TX | crate::Gp28Uart0Tx |
I2C0 SDA | crate::Gp28I2C0Sda |
PWM6 A | crate::Gp28Pwm6A |
PIO0 | crate::Gp28Pio0 |
PIO1 | crate::Gp28Pio1 |
gpio27: Pin<Gpio27, <Gpio27 as DefaultTypeState>::Function, <Gpio27 as DefaultTypeState>::PullType>
GPIO 27 supports following functions:
Function | Alias with applied function |
---|---|
SPI1 TX | crate::Gp27Spi1Tx |
UART1 RTS | crate::Gp27Uart1Rts |
I2C1 SCL | crate::Gp27I2C1Scl |
PWM5 B | crate::Gp27Pwm5B |
PIO0 | crate::Gp27Pio0 |
PIO1 | crate::Gp27Pio1 |
gpio26: Pin<Gpio26, <Gpio26 as DefaultTypeState>::Function, <Gpio26 as DefaultTypeState>::PullType>
GPIO 26 supports following functions:
Function | Alias with applied function |
---|---|
SPI1 SCK | crate::Gp26Spi1Sck |
UART1 CTS | crate::Gp26Uart1Cts |
I2C1 SDA | crate::Gp26I2C1Sda |
PWM5 A | crate::Gp26Pwm5A |
PIO0 | crate::Gp26Pio0 |
PIO1 | crate::Gp26Pio1 |
gpio22: Pin<Gpio22, <Gpio22 as DefaultTypeState>::Function, <Gpio22 as DefaultTypeState>::PullType>
GPIO 22 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 SCK | crate::Gp22Spi0Sck |
UART1 CTS | crate::Gp22Uart1Cts |
I2C1 SDA | crate::Gp22I2C1Sda |
PWM3 A | crate::Gp22Pwm3A |
PIO0 | crate::Gp22Pio0 |
PIO1 | crate::Gp22Pio1 |
gpio20: Pin<Gpio20, <Gpio20 as DefaultTypeState>::Function, <Gpio20 as DefaultTypeState>::PullType>
GPIO 20 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 RX | crate::Gp20Spi0Rx |
UART1 TX | crate::Gp20Uart1Tx |
I2C0 SDA | crate::Gp20I2C0Sda |
PWM2 A | crate::Gp20Pwm2A |
PIO0 | crate::Gp20Pio0 |
PIO1 | crate::Gp20Pio1 |
gpio23: Pin<Gpio23, <Gpio23 as DefaultTypeState>::Function, <Gpio23 as DefaultTypeState>::PullType>
GPIO 23 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 TX | crate::Gp23Spi0Tx |
UART1 RTS | crate::Gp23Uart1Rts |
I2C1 SCL | crate::Gp23I2C1Scl |
PWM3 B | crate::Gp23Pwm3B |
PIO0 | crate::Gp23Pio0 |
PIO1 | crate::Gp23Pio1 |
gpio21: Pin<Gpio21, <Gpio21 as DefaultTypeState>::Function, <Gpio21 as DefaultTypeState>::PullType>
GPIO 21 supports following functions:
Function | Alias with applied function |
---|---|
SPI0 CSn | crate::Gp21Spi0Csn |
UART1 RX | crate::Gp21Uart1Rx |
I2C0 SCL | crate::Gp21I2C0Scl |
PWM2 B | crate::Gp21Pwm2B |
PIO0 | crate::Gp21Pio0 |
PIO1 | crate::Gp21Pio1 |
neopixel: Pin<Gpio25, <Gpio25 as DefaultTypeState>::Function, <Gpio25 as DefaultTypeState>::PullType>
GPIO 25 is connected to a neopixel on the top right of the board
Implementations§
Source§impl Pins
impl Pins
Sourcepub fn new(
io: IO_BANK0,
pads: PADS_BANK0,
sio: SioGpioBank0,
reset: &mut RESETS,
) -> Self
pub fn new( io: IO_BANK0, pads: PADS_BANK0, sio: SioGpioBank0, reset: &mut RESETS, ) -> Self
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more