Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Esp Hal Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-esp-hal-knowledge-patch)
---
name: esp-hal-knowledge-patch
description: esp-hal
version: "1.2.0"
license: MIT
metadata:
author: Nevaberry
---
# esp-hal compatibility guidance
Load this skill when migrating esp-hal applications or working with its peripheral
ownership, drivers, interrupts, sleep, allocation, radio, and RTOS integration.
Use the topic references for complete API details and chip-specific conditions.
Keep each migration tied to the crate and version named beside its guidance;
older migration steps remain in the references where APIs changed again later.
## Reference index
| Reference | Topics |
| --- | --- |
| [HAL setup and ownership](references/api-and-ownership.md) | Toolchains, features, entry points, singletons, builders, enum names, targets |
| [GPIO](references/gpio.md) | Pin ownership, configuration, routing, async events, interrupt status |
| [Interrupts and runtimes](references/interrupts-and-runtime.md) | Handler binding, priorities, software interrupts, locks, stack checks, chip runtimes |
| [Time and clocks](references/time-and-clocks.md) | Time types, timer modes, alarms, watchdogs, clock queries |
| [DMA and SPI](references/dma-and-spi.md) | Channel bounds, buffer ownership, memory-to-memory DMA, SPI transfers |
| [UART and I2C](references/uart-and-i2c.md) | Blocking and async I/O, errors, FIFO settings, timeouts, DMA, breaks |
| [Sleep and low-power cores](references/sleep-and-low-power.md) | Persistent wake sources, GPIO and UART wake, ULP/LP cores, wake causes |
| [I2S and parallel I/O](references/i2s-and-parallel-io.md) | TDM, PDM, streaming DMA, PARL_IO, LCD, camera |
| [RMT and signals](references/rmt-and-signals.md) | RMT channels, pulse buffers, transactions, PWM, TWAI |
| [Cryptography and analog](references/crypto-and-analog.md) | RNG, AES, RSA, SHA, ECC, ADC, sensors, eFuse |
| [Memory and diagnostics](references/memory-and-diagnostics.md) | PSRAM, allocators, RAM placement, linker hooks, backtraces, logging |
| [Configuration and macros](references/configuration-and-macros.md) | Build keys, validators, builders, entry points, documentation macros |
| [Flash storage](references/flash-storage.md) | Flash ownership, inherent I/O, storage traits, encryption, multicore access |
| [Radio networking](references/radio-networking.md) | Scheduler migration, Wi-Fi lifecycle and events, scanning, BLE, IEEE 802.15.4 |
| [RTOS integration](references/rtos-integration.md) | Embassy migration, scheduler startup, multicore tasks, sleep hooks, stack checks |
## Breaking changes and deprecations
### Toolchain, features, and entry point
The HAL uses Rust edition 2024 and requires Rust 1.88. Libraries should disable
HAL default features so the binary controls `rt`, `exception-handler`, and the
Xtensa `float-save-restore` feature. Enable `unstable` explicitly for gated APIs.
Replace `log` with `log-04`, use `defmt` 1.0, and remove `debug` and the former
public `usb_otg` and `bluetooth` features.
Use `#[esp_hal::main]` instead of `entry`. The `macros` module is private, and
`esp_hal::prelude` imports must move to the defining modules.
### Singleton lifetimes and driver configuration
Replace `Peripheral` and `PeripheralRef` with singleton types. Use `reborrow`
for shorter borrows and conversions instead of inherent `degrade` calls.
Numbered GPIO and concrete DMA channel types live in `esp_hal::peripherals`.
Include `..` when destructuring the non-exhaustive `Peripherals`.
Remove peripheral-instance type arguments and replace `new_typed` with standard
constructors. Use configuration builders and accessors for private fields, and
wildcard arms for non-exhaustive enums. Keep `Async` drivers on their owning
thread or core because they no longer implement `Send`.
### GPIO construction and routing
Pass configuration structs to GPIO constructors. Replace `OutputOpenDrain`
with a configured output. Pass a GPIO pin directly for bidirectional I2C and
half-duplex SPI signals: `gpio::Output` no longer satisfies those bounds.
SPI, UART, and I2C disconnect replaced pins and disconnect their pins on drop.
Check chip or module reservations before using GPIO singletons.
### Time, clocks, and interrupts
Use `esp_hal::time::{Rate, Duration, Instant}` instead of the old `fugit`
reexports, and replace `esp_hal::time::now()` with `Instant::now()`.
For the esp-hal 1.2.0 `unstable` clock migration, replace `Clocks::get()` and its
fields with free functions; use `clock::ll` for chip-specific queries.
The low-level clock controls are experimental.
```rust
use esp_hal::{clock, time::Rate};
let cpu_freq = clock::cpu_clock();
let apb_freq = Rate::from_hz(clock::ll::apb_clk_frequency());
let xtal_freq = clock::xtal_clock();
```
Replace `bind_interrupt` plus `enable` with safe, infallible `bind_handler`.
Clear relevant GPIO interrupt status in custom handlers; the HAL leaves it set
by default. For esp-hal 1.2.0's `unstable` software interrupt construction,
replace `SoftwareInterruptControl` with the matching `FROM_CPU_INTRn` singleton.
### SPI DMA and channel bounds
For esp-hal 1.2.0's `unstable` APIs, `SpiDma::with_buffers(rx_buf, tx_buf)` returns
`SpiDma`, which directly implements blocking and async `SpiBus` traits.
Replace the former buffer-owning methods as follows:
| Former method | Replacement |
| --- | --- |
| `read` | `read_buffer` |
| `write` | `write_buffer` |
| `transfer` | `transfer_buffers` |
| `half_duplex_read` | `half_duplex_read_buffer` |
| `half_duplex_write` | `half_duplex_write_buffer` |
Remove `SpiDmaBus`. Recover buffers with `SpiDmaTransfer::wait()` on transfers
started by the buffer methods, replacing `SpiDmaBus::split()`.
Replace `DmaChannelFor` and the peripheral channel aliases with driver channel
traits such as `SpiDmaChannel` or `I2sDmaChannel` in the same migration.
Since 1.1.1, dropping a SPI DMA transfer object also drops its bus and buffer;
keep the object through completion if you need to recover those resources.
`SpiDma<Async>` waits for completion on the SPI interrupt.
### I2S configuration and transfer ownership
For esp-hal 1.2.0's `unstable` APIs, pass `TdmConfig` to `I2s::new` and move
sample-rate, channel, and data-format builders from the former public `Config`.
Call channel `.build()` without descriptors. Use `dma_rx_buffer!` and
`dma_tx_buffer!` for one-shot buffers, or `dma_rx_stream_buffer!` and
`dma_tx_stream_buffer!` for streaming buffers.
Call `I2s::into_async()` before building channels for async transfers.
`read(buffer)` and `write(buffer)` consume both channel and buffer; starting
failures return `Err((error, channel, buffer))`. One-shot `wait()` or
`wait_async().await` returns the completion result, channel, and buffer.
Streaming handles expose the buffer view; replace `wait_for_data().await`
with `wait_for_available_async().await` and use `available_bytes()` directly.
### Sleep and wakeup ownership
For esp-hal 1.2.0's `unstable` sleep APIs, arm wakeup through the owning driver
and pass `RtcSleepConfig::default()` to `sleep_light` or `RtcSleepConfig::deep()`
to `sleep_deep`. Wake enables persist across sleep, deep-sleep wake, and driver
drop until explicitly disabled. Without an enabled source that can wake the
chip, light sleep returns immediately and deep sleep panics.
Replace `TimerWakeupSource` with an absolute wakeup deadline, which remains
armed until replaced or cleared with `clear_wakeup_deadline`.
`Input::listen` and the `wait_for` family arm interrupts and light-sleep wake;
replace `wakeup_enable`, `WaitForOptions`, and the old GPIO wake-source types.
Deep sleep and light sleep with `pd_hp_periph` or `pd_top` require a low-power
pad with the low-power path enabled. Configure a pull opposite the wake level
or use an external resistor for level-triggered wake.
### UART and I2C I/O
Use blocking UART `read` and `write` instead of `read_bytes` and `write_bytes`,
and use the returned byte count. `flush` is blocking and fallible; reads and
writes have separate `RxError` and `TxError` types.
UART `read_async` and `write_async` are cancellation-safe. `read_exact_async`,
`split`, and the split-half types require `unstable`.
Since 1.1.1, the RX FIFO full threshold must be nonzero, and successful
`read_async` into a nonempty buffer returns at least one byte.
Async-mode I2C exposes blocking methods and their `_async` counterparts.
Dropping an async operation cancels it; the driver clears the bus after errors
when necessary. Hardware and software timeouts require `unstable` and default
to their maximum values. `Config::with_software_timeout` handles a stuck-low SCL.
### Radio lifecycle and scheduler migration
`esp-wifi` becomes `esp-radio` in 0.16.0 and removes `builtin-scheduler`;
applications must supply a scheduler. In 0.18.0, construct Wi-Fi and BLE without
a shared controller argument: `esp_radio::init` is private and `Controller`
is removed. Use `wifi::Config` for the former `ModeConfig`, and
`wifi::ControllerConfig` for the former `wifi::Config`.
In esp-radio 0.18.0, `set_config` starts or restarts Wi-Fi; dropping the
controller stops it. Failed `set_config` also stops Wi-Fi. Migrate blocking
controller operations to the configuration-driven lifecycle and remaining
async operations. Select the radio crate's own `unstable` for its gated APIs.
### PSRAM and Embassy migration
Use the `Psram` driver in place of the `psram` feature, and `Psram::raw_parts`
in place of `esp_hal::psram::psram_raw_parts`. `esp_alloc::psram_allocator!`
accepts explicit PSRAM configuration or an already configured `Psram` driver.
ESP32-S3 uses `PsramMode`, defaulting to `Auto` for Quad or Octal SPI detection;
if detection fails, SPI1 is left uninitialized.
Replace `esp-hal-embassy` with `esp-rtos`. From esp-rtos 0.3.0, call
`esp_rtos::start` outside interrupt handlers. In 0.4.0, scheduler start functions
and `InterruptExecutor::new` take corresponding `FROM_CPU_INTRn` singletons.
Select required HAL and allocator features explicitly: esp-rtos disables defaults
on those dependencies from 0.3.0, and esp-radio disables esp-alloc defaults in 0.18.0.
## Frequently used capabilities
### Allocation and flash storage
Use `AnyMemory`, `InternalMemory`, or `ExternalMemory` with `allocator_api2`
collections to choose allocation regions on stable Rust. Use
`DmaCompatibleInternalMemory` or `DmaCompatibleExternalMemory` for DMA alignment.
In esp-storage 0.10.0, inherent `read`, `write`, and `capacity` provide byte
storage; `read_nor`, `write_nor`, and `erase` provide NOR operations. Enable the
non-default `embedded-storage` feature when using its traits, keeping existing features.
### Wi-Fi events and scans
In esp-radio 0.18.0, use `WifiController::subscribe()` for an `EventSubscriber`
in place of generic event waits and `EventExt` handlers; `event` requires `unstable`.
Use `ESP_RADIO_CONFIG_EVENT_CHANNEL_CAPACITY` and
`ESP_RADIO_CONFIG_EVENT_CHANNEL_SUBSCRIBERS` for queue and subscriber limits.
Use `scan_async` instead of `scan_with_config_async`, with `ScanConfig` and
`ScanTypeConfig` from `wifi::scan` and scan durations from `esp_hal::time::Duration`.
### RTOS sleep and UART breaks
In esp-rtos 0.4.0, `esp_rtos::sleep::configure` replaces `auto_light_sleep` and
returns a `Sleep` containing the idle hook and deep-sleep handle. The hook
restores timekeeping and rearms the scheduler timer after light sleep.
Use `ESP_RTOS_CONFIG_LIGHT_SLEEP_MIN_US` to skip automatic light sleep below
the configured expected residency in microseconds.
UART supports blocking `send_break`, `wait_for_break`, and
`wait_for_break_with_timeout`, interrupt detection with `RxBreakDetected`, and
async detection with `wait_for_break_async`.