From a7b71bd5aa5fd8143801dd1bd8ac6a7186ad8768 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Sun, 9 Jan 2022 15:16:01 +0100 Subject: [PATCH] Fix compilation bug in the documentation --- rp2040-hal/src/gpio/pin.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rp2040-hal/src/gpio/pin.rs b/rp2040-hal/src/gpio/pin.rs index 90d9317..15a8508 100644 --- a/rp2040-hal/src/gpio/pin.rs +++ b/rp2040-hal/src/gpio/pin.rs @@ -1102,9 +1102,15 @@ macro_rules! bsp_pins { /// /// like this: ///```no_run - /// let _spi_sclk = pins.gpio2.into_mode::(); - /// let _spi_mosi = pins.gpio3.into_mode::(); - /// let _spi_miso = pins.gpio4.into_mode::(); + /// 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::(); + /// let _spi_mosi = pins.gpio3.into_mode::(); + /// let _spi_miso = pins.gpio4.into_mode::(); ///``` /// /// **See also [rp2040_hal::gpio::pin] for more in depth information