Please note that only changes to the esp-hal package are tracked in these release notes.
Migration Guide
SystemControl
We have removed the SystemExt trait, meaning that the SYSTEM peripheral no longer has a split() method. Instead, we now instantiate a new SystemControl struct:
use esp_hal::{peripherals::Peripherals, system::SystemControl, clock::ClockControl};
let peripherals = Peripherals::take();
let system = SystemControl::new(peripherals.SYSTEM);
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();Timers
There have been a number of changes to the various timer drivers in esp-hal, notable the reorganization of their modules. While previously we had systimer (SYSTIMER) and timer (TIMGx) modules, these have been combined into a common module, and are now available at timer::systimer and timer::timg0 respectively.
Additionally, there have been some minor changes in API relating to the introduction of the timer::Timer trait; these should be mostly straight forward to resolve, refer to the documentation.
GPIO
The GPIO system has been reworked to remove into_X methods, in favour of a concrete pin type.
| Old into_X method | New type |
|---|---|
| output | Output
|
| output open drain | OutputOpenDrain
|
| input | Input
|
For example code such as io.pins.gpio18.into_push_pull_output() should be replaced with Output::new(io.pins.gpio18) for each respective case. To see more discussion and examples for this change, see the RFC and implementation PR.
esp-hal-embassy
As of this release, support for [Embassy] has been extracted from esp-hal into its own package, esp-hal-embassy. This is nearly a drop-in replacement, only a few small changes are required.
First, add the new dependency to your Cargo.toml:
[dependencies]
esp-hal-embassy = { version = "0.1.0", features = [
"time-timg0", # Compatible with all chips
# "time-systimer-16mhz", # Compatible with all chips except ESP32 and ESP32-S2
# "time-systimer-80mhz", # Compatible with ESP32-S2 only
] }Note that in previous version, the time-systimer-* features were incorrectly named time-systick-*; this has now been rectified. Additionally, as of this release it is no longer required to select an executor via its Cargo feature; both the thread-mode and interrupt-mode executors are now available by default.
Next, simply replace any references to the esp_hal::embassy module and its children with the esp_hal_embassy package instead. This can likely be accomplished with a simple search-and-replace in your text editor.
Changelog
Added
- i2c: implement
I2C:transactionforembedded-halandembedded-hal-async(#1505) - spi: implement
with_bit_order(#1537) - ESP32-PICO-V3-02: Initial support (#1155)
time::current_timeAPI (#1503)- ESP32-S3: Add LCD_CAM Camera driver (#1483)
embassy-usbsupport (#1517)- SPI Slave support for ESP32-S2 (#1562)
- Add new generic
OneShotTimerandPeriodicTimerdrivers, plus newTimertrait which is implemented forTIMGxandSYSTIMER(#1570)
Fixed
- i2c: i2c1_handler used I2C0 register block by mistake (#1487)
- Removed ESP32 specific code for resolutions > 16 bit in ledc embedded_hal::pwm max_duty_cycle function. (#1441)
- Fixed division by zero in ledc embedded_hal::pwm set_duty_cycle function and converted to set_duty_hw instead of set_duty to eliminate loss of granularity. (#1441)
- Embassy examples now build on stable (#1485)
- Fix delay on esp32h2 (#1535)
- spi: fix dma wrong mode when using eh1 blocking api (#1541)
- uart: make
uart::UartRx::read_bytepublic (#1547) - Fix async serial-usb-jtag (#1561)
- Feeding
RWDTnow actually works (#1645)
Changed
- Removed unneeded generic parameters on
Usb(#1469) - Created virtual peripherals for CPU control and radio clocks, rather than splitting them from
SYSTEM(#1428) IO,ADC,DAC,RTC*,LEDC,PWMandPCNTdrivers have been converted to camel case format (#1473)- RNG is no longer TRNG, the
CryptoRngimplementation has been removed. To track this being re-added see #1499 (#1498) - Make software interrupts shareable (#1500)
- The
SystemPartsstruct has been renamed toSystemControl, and now has a constructor which takes theSYSTEMperipheral (#1495) - Timer abstraction: refactor
systimerandtimermodules into a commontimermodule (#1527) - Removed the
embassy-executor-threadandembassy-executor-interruptfeatures, they are now enabled by default whenembassyis enabled. (#1485) - Software interrupt 3 is now used instead of software interrupt 0 on the thread aware executor on multicore systems (#1485)
- Timer abstraction: refactor
systimerandtimermodules into a commontimermodule (#1527) - Refactoring of GPIO module, have drivers for Input,Output,OutputOpenDrain, all drivers setup their GPIOs correctly (#1542)
- DMA transactions are now found in the
dmamodule (#1550) - Remove unnecessary generics from PARL_IO driver (#1545)
- Use
Level enumin GPIO constructors instead of plain bools (#1574) - rmt: make ChannelCreator public (#1597)