Crate rp2040_hal

source ·
Expand description

HAL for the RP2040 microcontroller

This is an implementation of the embedded-hal traits for the RP2040 microcontroller

NOTE This HAL is still under active development. This API will remain volatile until 1.0.0

§Crate features

  • chrono - Add conversion functions between chrono types and the rp2040-hal specific DateTime type
  • critical-section-impl - critical section that is safe for multicore use
  • defmt - Implement defmt::Format for several types.
  • disable-intrinsics - Disable automatic mapping of language features (like floating point math) to ROM functions
  • embedded_hal_1 - Support alpha release of embedded-hal
  • rom-func-cache - Memoize(cache) ROM function pointers on first use to improve performance
  • rt - Minimal startup / runtime for Cortex-M microcontrollers
  • rom-v2-intrinsics - This enables ROM functions for f64 math that were not present in the earliest RP2040s
  • rp2040-e5 - This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus. Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above. Note that the workaround takes control of pin 15 (bank0) during usb reset so the bank needs to be taken out of reset before calling UsbBus::new. Using let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS); is enough to take the Bank 0 out of reset.
  • rtic-monotonic - Implement rtic_monotonic::Monotonic based on the RP2040 timer peripheral
  • i2c-write-iter - Implement i2c_write_iter traits for I2C<_, _, Controller>.

Re-exports§

Modules§

  • Analog-Digital Converter (ADC)
  • Commonly used in async implementations.
  • Clocks (CLOCKS)
  • Direct memory access (DMA).
  • General Purpose Input and Output (GPIO)
  • Inter-Integrated Circuit (I2C) bus
  • Multicore support
  • Programmable IO (PIO) See Chapter 3 of the datasheet for more details.
  • Phase-Locked Loops (PLL)
  • Prelude
  • Pulse Width Modulation (PWM)
  • Subsystem Resets
  • Functions and data from the RPI Bootrom.
  • Ring Oscillator (ROSC)
  • Real time clock functionality
  • Single Cycle Input and Output (SIO)
  • Serial Peripheral Interface (SPI)
  • Synchronous Serial Interface (SSI)
  • Timer Peripheral
  • Module supporting type-level programming
  • Universal Asynchronous Receiver Transmitter (UART)
  • Universal Serial Bus (USB)
  • Interrupt vector table utilities
  • On-chip voltage regulator (VREG)
  • Watchdog
  • Crystal Oscillator (XOSC)

Macros§

  • Helper macro to give meaningful names to GPIO pins

Functions§

  • Halt the RP2040.
  • Trigger full reset of the RP2040.

Attribute Macros§

  • Attribute to declare the entry point of the program