Crate embassy_rp
source ·Expand description
Embassy RP HAL
HALs implement safe, idiomatic Rust APIs to use the hardware capabilities, so raw register manipulation is not needed.
The embassy-rp HAL targets the Raspberry Pi RP2040 microcontroller. The HAL implements both blocking and async APIs for many peripherals. The benefit of using the async APIs is that the HAL takes care of waiting for peripherals to complete operations in low power mode and handling interrupts, so that applications can focus on more important matters.
embassy-time
time driver
If the time-driver
feature is enabled, the HAL uses the TIMER peripheral as a global time driver for embassy-time, with a tick rate of 1MHz.
Embedded-hal
The embassy-rp
HAL implements the traits from embedded-hal (v0.2 and 1.0) and embedded-hal-async, as well as embedded-io and embedded-io-async.
Interoperability
This crate can run on any executor.
Optionally, some features requiring embassy-time
can be activated with the time
feature. If you enable it,
you must link an embassy-time
driver in your project.
Feature flags
rt
(enabled by default) — Enable the RP runtime.defmt
— Enable defmtcritical-section-impl
— critical section that is safe for multicore useunstable-pac
— Reexport the PAC for the currently enabled chip atembassy_rp::pac
. This is unstable because semver-minor (non-breaking) releases of embassy-rp may major-bump (breaking) the PAC version. If this is an issue for you, you’re encouraged to directly depend on a fixed version of the PAC. There are no plans to make this stable.time-driver
— Enable the timer for use withembassy-time
with a 1MHz tick raterom-func-cache
— Enable ROM function cacheintrinsics
— Enable intrinsicsrom-v2-intrinsics
— Enable ROM v2 intrinsicsqspi-as-gpio
— Allow using QSPI pins as GPIO pins. This is mostly not what you want (because your flash lives there) and would add both code and memory overhead when enabled needlessly.run-from-ram
— Indicate code is running from RAM. Set this if all code is in RAM, and the cores never access memory-mapped flash memory through XIP. This allows the flash driver to not force pausing execution on both cores when doing flash operations.
boot2 flash chip support
If none of these are enabled, w25q080 is used by default (used on the pico)
boot2-at25sf128a
— AT25SF128aboot2-gd25q64cs
— GD25Q64csboot2-generic-03h
— generic-03hboot2-is25lp080
— IS25LP080boot2-ram-memcpy
— ram-memcpyboot2-w25q080
— W25Q080boot2-w25x10cl
— W25X10cl
Re-exports
pub use rp_pac as pac;
Modules
- ADC driver.
- Boot Select button
- Clock configuration for the RP2040
- HAL configuration for RP.
- Direct Memory Access (DMA)
- Flash driver.
- GPIO driver.
- I2C driver.
- I2C slave driver.
- Interrupt definitions.
- Multicore support
- Types for the peripheral singletons.
- PIO driver.
- Pulse Width Modulation (PWM)
- Functions and data from the RPI Bootrom.
- RTC driver.
- Serial Peripheral Interface
- Timer driver.
- UART driver.
- USB driver.
- Watchdog
Macros
- Macro to bind interrupts to handlers.
- Convenience converting into reference.
Structs
- An exclusive reference to a peripheral.
- Struct containing all the peripheral singletons.
Constants
- Number available in the NVIC for configuring priority
Traits
- Trait for any type that can be used as a peripheral of type
P
.
Functions
- Initialize the
embassy-rp
HAL with the provided configuration. - Installs a stack guard for the CORE0 stack in MPU region 0. Will fail if the MPU is already confgigured. This function requires a
_stack_end
symbol to be defined by the linker script, and expexcts_stack_end
to be located at the lowest address (largest depth) of the stack.