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>.
  • binary-info - Include a static variable containing picotool compatible binary info.

Re-exports§

pub extern crate fugit;
pub use adc::Adc;
pub use clocks::Clock;
pub use i2c::I2C;
pub use sio::Sio;
pub use spi::Spi;
pub use timer::Timer;
pub use watchdog::Watchdog;
pub use rp2040_pac as pac;
pub use rp_binary_info as binary_info;

Modules§

adc
Analog-Digital Converter (ADC)
arch
Portable in-line assembly
async_utils
Commonly used in async implementations.
clocks
Clocks (CLOCKS)
dma
Direct memory access (DMA).
gpio
General Purpose Input and Output (GPIO)
i2c
Inter-Integrated Circuit (I2C) bus
multicore
Multicore support
pio
Programmable IO (PIO)
pll
Phase-Locked Loops (PLL)
prelude
Prelude
pwm
Pulse Width Modulation (PWM)
resets
Subsystem Resets
rom_data
Functions and data from the RPI Bootrom.
rosc
Ring Oscillator (ROSC)
rtc
Real time clock functionality
sio
Single Cycle Input and Output (SIO)
spi
Serial Peripheral Interface (SPI)
ssi
Synchronous Serial Interface (SSI)
timer
Timer Peripheral
typelevel
Module supporting type-level programming
uart
Universal Asynchronous Receiver Transmitter (UART)
usb
Universal Serial Bus (USB)
vector_table
Interrupt vector table utilities
vreg
On-chip voltage regulator (VREG)
watchdog
Watchdog
xosc
Crystal Oscillator (XOSC)

Macros§

bsp_pins
Helper macro to give meaningful names to GPIO pins

Functions§

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

Attribute Macros§

entry
Attribute to declare the entry point of the program