Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/embedded/board/pico2_w"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
cyw43 |
std/embedded/wireless/cyw43 |
pico2_w.dodo |
hal |
std/embedded/hal |
pico2_w.dodo |
rp2350 |
std/embedded/chip/rp2350 |
pico2_w.dodo |
NAME
Constant · Source
pub const NAME: &str = "Raspberry Pi Pico 2 W"
CRYSTAL_HZ
Constant · Source
pub const CRYSTAL_HZ: u32 = 12_000_000
LED_GPIO
Constant · Source
The wireless chip’s GPIO that drives the LED.
pub const LED_GPIO: u32 = 0
VBUS_GPIO
Constant · Source
The wireless chip’s GPIO that reads high while USB power (VBUS) is present.
pub const VBUS_GPIO: u32 = 2
WL_POWER_PIN
Constant · Source
RP2350 pins wired to the wireless chip.
pub const WL_POWER_PIN: u32 = 23
WL_DATA_PIN
Constant · Source
pub const WL_DATA_PIN: u32 = 24
WL_SELECT_PIN
Constant · Source
pub const WL_SELECT_PIN: u32 = 25
WL_CLOCK_PIN
Constant · Source
pub const WL_CLOCK_PIN: u32 = 29
I2C_SDA_PIN
Constant · Source
The usual bus pins, as in the Pico SDK and Raspberry Pi’s pinout diagrams: I2C0 on GP4 (SDA) and GP5 (SCL), and SPI0 on GP16 (RX), GP18 (clock), and GP19 (TX), with GP17 free for a chip select:
i2c := b.pins.i2c(I2C_SDA_PIN, I2C_SCL_PIN, hal.I2C_FAST_HZ)!
pub const I2C_SDA_PIN: u32 = 4
I2C_SCL_PIN
Constant · Source
pub const I2C_SCL_PIN: u32 = 5
SPI_RX_PIN
Constant · Source
pub const SPI_RX_PIN: u32 = 16
SPI_SELECT_PIN
Constant · Source
pub const SPI_SELECT_PIN: u32 = 17
SPI_CLOCK_PIN
Constant · Source
pub const SPI_CLOCK_PIN: u32 = 18
SPI_TX_PIN
Constant · Source
pub const SPI_TX_PIN: u32 = 19
Board
Struct · Source
pub struct Board {
// The user LED, on when high. Changing it is one gSPI write to the
// wireless chip, about 20 us with -O2.
pub led: Led
// The remaining GPIOs, and the I2C and SPI buses on them; GP23 to GP25
// and GP29 are taken by the wireless chip.
pub pins: rp2350.Pins
// The 1 MHz system timer: delay_us, delay_ms, and now_us.
pub timer: rp2350.Timer
}
take
Function · Source
Start the chip with the Pico 2 W’s crystal, power up the wireless chip, and turn the LED off. Takes about 270 ms, most of it the wireless chip’s power-up. A second call returns hal.Error.Busy; a wireless chip that does not answer returns hal.Error.Timeout.
pub fn take() -> Board!hal.Error
Led
Struct · Source
The LED on the wireless chip’s GPIO 0. Implements the std/embedded/hal output pin protocol, plus toggle and is_high like an RP2350 pin.
pub struct Led {
// Private implementation fields omitted.
}
Led.set_high
Function · Source
pub fn set_high(&mut self)
Led.set_low
Function · Source
pub fn set_low(&mut self)
Led.toggle
Function · Source
pub fn toggle(&mut self)
Led.is_high
Function · Source
The level last written.
pub fn is_high(&self) -> bool
Led.read_back
Function · Source
The level on the LED’s pin, read back from the wireless chip.
pub fn read_back(&mut self) -> bool
Led.usb_powered
Function · Source
True while the board has USB power, from the wireless chip’s VBUS sense input.
pub fn usb_powered(&mut self) -> bool
reboot_to_bootloader
Function · Source
Restart into the USB bootloader, as if BOOTSEL were held at power-up: the Pico 2 W reappears as the RP2350 drive, ready for
dodo run. There is no activity LED, since GP25 is the wireless chip’s select line. Does not return.
pub fn reboot_to_bootloader()