pub struct Pins {Show 22 fields
pub tx: Pin<Gpio0, <Gpio0 as DefaultTypeState>::Function, <Gpio0 as DefaultTypeState>::PullType>,
pub rx: Pin<Gpio1, <Gpio1 as DefaultTypeState>::Function, <Gpio1 as DefaultTypeState>::PullType>,
pub d2: Pin<Gpio2, <Gpio2 as DefaultTypeState>::Function, <Gpio2 as DefaultTypeState>::PullType>,
pub d3: Pin<Gpio3, <Gpio3 as DefaultTypeState>::Function, <Gpio3 as DefaultTypeState>::PullType>,
pub d4: Pin<Gpio4, <Gpio4 as DefaultTypeState>::Function, <Gpio4 as DefaultTypeState>::PullType>,
pub d5: Pin<Gpio5, <Gpio5 as DefaultTypeState>::Function, <Gpio5 as DefaultTypeState>::PullType>,
pub d6: Pin<Gpio6, <Gpio6 as DefaultTypeState>::Function, <Gpio6 as DefaultTypeState>::PullType>,
pub d7: Pin<Gpio7, <Gpio7 as DefaultTypeState>::Function, <Gpio7 as DefaultTypeState>::PullType>,
pub d8: Pin<Gpio8, <Gpio8 as DefaultTypeState>::Function, <Gpio8 as DefaultTypeState>::PullType>,
pub d9: Pin<Gpio9, <Gpio9 as DefaultTypeState>::Function, <Gpio9 as DefaultTypeState>::PullType>,
pub d10: Pin<Gpio10, <Gpio10 as DefaultTypeState>::Function, <Gpio10 as DefaultTypeState>::PullType>,
pub d11: Pin<Gpio11, <Gpio11 as DefaultTypeState>::Function, <Gpio11 as DefaultTypeState>::PullType>,
pub sda: Pin<Gpio12, <Gpio12 as DefaultTypeState>::Function, <Gpio12 as DefaultTypeState>::PullType>,
pub scl: Pin<Gpio13, <Gpio13 as DefaultTypeState>::Function, <Gpio13 as DefaultTypeState>::PullType>,
pub neopixel: Pin<Gpio17, <Gpio17 as DefaultTypeState>::Function, <Gpio17 as DefaultTypeState>::PullType>,
pub sclk: Pin<Gpio18, <Gpio18 as DefaultTypeState>::Function, <Gpio18 as DefaultTypeState>::PullType>,
pub mosi: Pin<Gpio19, <Gpio19 as DefaultTypeState>::Function, <Gpio19 as DefaultTypeState>::PullType>,
pub miso: Pin<Gpio20, <Gpio20 as DefaultTypeState>::Function, <Gpio20 as DefaultTypeState>::PullType>,
pub a0: Pin<Gpio26, <Gpio26 as DefaultTypeState>::Function, <Gpio26 as DefaultTypeState>::PullType>,
pub a1: Pin<Gpio27, <Gpio27 as DefaultTypeState>::Function, <Gpio27 as DefaultTypeState>::PullType>,
pub a2: Pin<Gpio28, <Gpio28 as DefaultTypeState>::Function, <Gpio28 as DefaultTypeState>::PullType>,
pub a3: 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:
- 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§
§tx: Pin<Gpio0, <Gpio0 as DefaultTypeState>::Function, <Gpio0 as DefaultTypeState>::PullType>
§rx: Pin<Gpio1, <Gpio1 as DefaultTypeState>::Function, <Gpio1 as DefaultTypeState>::PullType>
§d2: Pin<Gpio2, <Gpio2 as DefaultTypeState>::Function, <Gpio2 as DefaultTypeState>::PullType>
§d3: Pin<Gpio3, <Gpio3 as DefaultTypeState>::Function, <Gpio3 as DefaultTypeState>::PullType>
§d4: Pin<Gpio4, <Gpio4 as DefaultTypeState>::Function, <Gpio4 as DefaultTypeState>::PullType>
§d5: Pin<Gpio5, <Gpio5 as DefaultTypeState>::Function, <Gpio5 as DefaultTypeState>::PullType>
§d6: Pin<Gpio6, <Gpio6 as DefaultTypeState>::Function, <Gpio6 as DefaultTypeState>::PullType>
§d7: Pin<Gpio7, <Gpio7 as DefaultTypeState>::Function, <Gpio7 as DefaultTypeState>::PullType>
§d8: Pin<Gpio8, <Gpio8 as DefaultTypeState>::Function, <Gpio8 as DefaultTypeState>::PullType>
§d9: Pin<Gpio9, <Gpio9 as DefaultTypeState>::Function, <Gpio9 as DefaultTypeState>::PullType>
§d10: Pin<Gpio10, <Gpio10 as DefaultTypeState>::Function, <Gpio10 as DefaultTypeState>::PullType>
§d11: Pin<Gpio11, <Gpio11 as DefaultTypeState>::Function, <Gpio11 as DefaultTypeState>::PullType>
§sda: Pin<Gpio12, <Gpio12 as DefaultTypeState>::Function, <Gpio12 as DefaultTypeState>::PullType>
§scl: Pin<Gpio13, <Gpio13 as DefaultTypeState>::Function, <Gpio13 as DefaultTypeState>::PullType>
§neopixel: Pin<Gpio17, <Gpio17 as DefaultTypeState>::Function, <Gpio17 as DefaultTypeState>::PullType>
§sclk: Pin<Gpio18, <Gpio18 as DefaultTypeState>::Function, <Gpio18 as DefaultTypeState>::PullType>
§mosi: Pin<Gpio19, <Gpio19 as DefaultTypeState>::Function, <Gpio19 as DefaultTypeState>::PullType>
§miso: Pin<Gpio20, <Gpio20 as DefaultTypeState>::Function, <Gpio20 as DefaultTypeState>::PullType>
§a0: Pin<Gpio26, <Gpio26 as DefaultTypeState>::Function, <Gpio26 as DefaultTypeState>::PullType>
§a1: Pin<Gpio27, <Gpio27 as DefaultTypeState>::Function, <Gpio27 as DefaultTypeState>::PullType>
§a2: Pin<Gpio28, <Gpio28 as DefaultTypeState>::Function, <Gpio28 as DefaultTypeState>::PullType>
§a3: Pin<Gpio29, <Gpio29 as DefaultTypeState>::Function, <Gpio29 as DefaultTypeState>::PullType>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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