Skip to main content

Crate rp2350

Crate rp2350 

Source
Expand description

§rp2350

Hardware Abstraction Layer for RP2350 microcontrollers (Raspberry Pi Pico 2)

§Features

  • rt - Runtime support (rp2350-rt)
  • atomics - Portable atomic operations
  • defmt - Defmt logging support
  • panic-handler - Built-in embedded panic handler for bare-metal targets
  • boot2-w25q80 / boot2-generic-03h - Link the optional second stage boot loader (XIP setup) and select the flash part; boot2 is the bare switch those features imply

§Panic And Logging

panic-handler is enabled by default on embedded targets. Disable it if the final binary provides its own #[panic_handler].

  • With defmt enabled, panic messages are emitted through the active defmt transport selected by the binary, such as defmt-rtt in the examples.
  • Without defmt, the panic handler skips formatted output and terminates the core immediately.
  • In both modes, interrupts are disabled first, SHCSR.USGFAULTENA is cleared through the runtime crate’s SCB definition, and execution ends in udf so the failure reliably escalates to HardFault.
  • The examples no longer depend on panic-probe; they use this crate’s built-in panic handler directly.

§Example

ⓘ
#![no_std]
#![no_main]

use rp2350::main;
use rp2350::systick::Delay;

#[main]
fn main() -> ! {
    let delay = Delay::init(cp.SYST, 150_000_000); // 150 MHz
    loop {
        delay.delay_ms(500);
    }
}

Re-exports§

pub use accessctrl::Accessctrl;
pub use adc::Adc;
pub use busctrl::Busctrl;
pub use clocks::Clocks;
pub use dcp::Dcp;
pub use dma::Channel;
pub use dma::Dma;
pub use eppb::Eppb;
pub use gpio::Pins;
pub use i2c::I2c0;
pub use i2c::I2c0Slave;
pub use i2c::I2c1;
pub use i2c::I2c1Slave;
pub use multicore::Fifo;
pub use multicore::Multicore;
pub use multicore::Stack;
pub use otp::Otp;
pub use pads_qspi::PadsQspi;
pub use powman::AonTimer;
pub use powman::Powman;
pub use powman::Timespec;
pub use pwm::Pwm;
pub use reboot::RebootKind;
pub use sha256::Sha256;
pub use spi::Spi0;
pub use spi::Spi0Slave;
pub use spi::Spi1;
pub use spi::Spi1Slave;
pub use syscfg::Syscfg;
pub use sysinfo::Sysinfo;
pub use systick::Delay;
pub use systick::SysTick;
pub use ticks::Ticks;
pub use time::Duration;
pub use time::Instant;
pub use timer::Timer0;
pub use timer::Timer1;
pub use trng::Trng;
pub use uart::Uart0;
pub use uart::Uart1;
pub use watchdog::Watchdog;
pub use xip::Xip;
pub use rp2350_rt as rt;
pub use rp2350_pac as pac;
pub use defmt;

Modules§

accessctrl
ACCESSCTRL (Access Control) HAL for RP2350
adc
ADC (Analog-to-Digital Converter) HAL for RP2350
binary_info
Binary Info support for RP2350
block
RP2350 Boot Block (PICOBIN) definitions
bootrom
RP2350 bootrom (mask ROM) API access
busctrl
BUSCTRL (Bus Control) HAL for RP2350
clocks
Clock Management HAL for RP2350
dcp
DCP (Double-precision Co-Processor) HAL for RP2350 Arm
delay
Delay abstraction trait
dma
DMA (Direct Memory Access) HAL for RP2350
eppb
EPPB (Extended Private Peripheral Bus) HAL for RP2350
flash
Flash read, erase and program through the bootrom
gpio
GPIO (General Purpose Input/Output) HAL for RP2350
gpioc
GPIO Coprocessor (GPIOC) for RP2350 Cortex-M33
i2c
I2C (Inter-Integrated Circuit) HAL for RP2350
interp
Hardware Interpolator (INTERP) driver for RP2350
interrupt
Interrupt Management HAL for RP2350
kit
Platform-independent utility library.
multicore
Multicore support for RP2350
otp
OTP (One-Time Programmable memory) HAL for RP2350
pads_qspi
QSPI pad configuration (PADS_QSPI) for RP2350
pin
Per-GPIO Pin Function Description for RP2350
pio
Programmable I/O (PIO) driver for RP2350
powman
Power Management (POWMAN) HAL for RP2350
ppb
PPB (Private Peripheral Bus) HAL for RP2350 Cortex-M33
pwm
PWM (Pulse Width Modulation) HAL for RP2350
qspi
QSPI (Quad SPI) HAL for RP2350
reboot
System reboot through the bootrom
reset
Reset subsystem for RP2350
sha256
SHA-256 hardware accelerator driver for RP2350
sio
Single-cycle IO (SIO) driver for RP2350
spi
SPI (Serial Peripheral Interface) HAL for RP2350
startup
Shared RP2350 startup initialisation.
syscfg
System Configuration (SYSCFG) HAL for RP2350
sysinfo
SYSINFO (System Information) HAL for RP2350
sysinfo_rom
System information read through the bootrom
systick
SysTick timer driver for Cortex-M33
ticks
TICKS (Tick Generator) HAL for RP2350
time
Time and Duration types for embedded systems
timer
Timer HAL for RP2350
trng
TRNG (True Random Number Generator) HAL for RP2350
uart
UART (Universal Asynchronous Receiver/Transmitter) HAL for RP2350
watchdog
WATCHDOG HAL for RP2350
xip
XIP (Execute-In-Place) HAL for RP2350

Macros§

bi_int_value
Declare an integer value with a tag and ID
bi_pin_range_with_func
Declare a pin range with a GPIO function
bi_pin_with_func
Declare a pin with a GPIO function (32-bit, for RP2350A with <=32 GPIOs)
bi_pin_with_name
Declare a pin with a custom name
bi_program_build_attribute
Declare a program build attribute
bi_program_build_date
Declare a program build date
bi_program_description
Declare a program description
bi_program_feature
Declare a program feature
bi_program_name
Declare a program name
bi_program_url
Declare a program URL
bi_program_version
Declare a program version string
bi_rp2350_board
Declare a Pico board identifier
bi_string_value
Declare a string value with a tag and ID
define_events
Define event ID constants
make_static
Allocate a value in a hidden static and return &'static mut T.
pio_asm
Compile PIO assembly code into a PioProgram

Structs§

CorePeripherals
Core Peripherals container
ExceptionFrame
Registers stacked (pushed into the stack) during an exception.
Peripherals
All the peripherals.
Steal
Zero-cost wrapper returned by steal() methods.

Enums§

Interrupt
RP2350 Interrupt enumeration

Attribute Macros§

bind
Bind a function to an interrupt handler
exception
Attribute to declare an exception handler
main
Attribute to declare the entry point of the program
ramfunc
Mark a function to be executed from RAM.