Skip to content

0.18.0

Compare
Choose a tag to compare
@jessebraham jessebraham released this 04 Jun 16:35
· 649 commits to main since this release
e50f663

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:transaction for embedded-hal and embedded-hal-async (#1505)
  • spi: implement with_bit_order (#1537)
  • ESP32-PICO-V3-02: Initial support (#1155)
  • time::current_time API (#1503)
  • ESP32-S3: Add LCD_CAM Camera driver (#1483)
  • embassy-usb support (#1517)
  • SPI Slave support for ESP32-S2 (#1562)
  • Add new generic OneShotTimer and PeriodicTimer drivers, plus new Timer trait which is implemented for TIMGx and SYSTIMER (#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_byte public (#1547)
  • Fix async serial-usb-jtag (#1561)
  • Feeding RWDT now 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, PWM and PCNT drivers have been converted to camel case format (#1473)
  • RNG is no longer TRNG, the CryptoRng implementation has been removed. To track this being re-added see #1499 (#1498)
  • Make software interrupts shareable (#1500)
  • The SystemParts struct has been renamed to SystemControl, and now has a constructor which takes the SYSTEM peripheral (#1495)
  • Timer abstraction: refactor systimer and timer modules into a common timer module (#1527)
  • Removed the embassy-executor-thread and embassy-executor-interrupt features, they are now enabled by default when embassy is 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 systimer and timer modules into a common timer module (#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 dma module (#1550)
  • Remove unnecessary generics from PARL_IO driver (#1545)
  • Use Level enum in GPIO constructors instead of plain bools (#1574)
  • rmt: make ChannelCreator public (#1597)

Removed

  • Removed the SystemExt trait (#1495)
  • Removed the GpioExt trait (#1496)
  • Embassy support (and all related features) has been removed, now available in the esp-hal-embassy package instead (#1595)