This repository has been archived on 2026-08-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
donglora/vendor/esp-hal-embassy/MIGRATING-0.3.md
T
swaitsandClaude Opus 4.6 3102fc747a feat: add display UI with splash screen, dashboard, and RSSI sparkline
Implement full SSD1306 OLED display support:
- Splash screen on boot (1.5s) with project name, version, board
- Dashboard showing radio state, config, counters, RSSI/SNR
- RSSI history sparkline (64-sample ring buffer, 2px-wide bars)
- DisplayOn/DisplayOff host commands routed via dedicated channel
- Pure render functions against generic DrawTarget (no hardware coupling)
- Display on/off control bypasses radio task entirely

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:42:54 -06:00

1.7 KiB

Migration Guide from 0.3.x to v0.4.x

Initialization

You no longer have to set up clocks and pass them to esp_hal_embassy::init.

 use esp_hal::{
-    clock::ClockControl,
-    peripherals::Peripherals,
     prelude::*,
-    system::SystemControl,
 };

 #[esp_hal_embassy::main]
 async fn main(_spawner: Spawner) -> ! {
-    let peripherals = Peripherals::take();
-    let system = SystemControl::new(peripherals.SYSTEM);
-    let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
+    let peripherals = esp_hal::init(esp_hal::Config::default());

     let timg0 = TimerGroup::new(peripherals.TIMG0);
-    esp_hal_embassy::init(&clocks, timg0);
+    esp_hal_embassy::init(timg0.timer0);

     // ...
 }

You have to specify a timer instance (that may be a TimerGroup timer unit or a SystemTimer alarm) or an array of AnyTimers when calling init. An example of how you can set multiple timers (for example when using multiple executors):

use esp_hal::{
    prelude::*,
    timer::{
        AnyTimer,
        systimer::SystemTimer
    }
};

#[esp_hal_embassy::main]
async fn main(_spawner: Spawner) -> ! {
    let peripherals = esp_hal::init(esp_hal::Config::default());

    let timg0 = TimerGroup::new(peripherals.TIMG0);
    let timer0: AnyTimer = timg0.timer0.into();
    let timer1: AnyTimer = timg0.timer1.into();

    // You can use either a TimerGroup timer, a SystemTimer alarm,
    // or you can mix and match them as well.
    let systimer = SystemTimer::new(peripherals.SYSTIMER).split::<Target>();
    let timer2: AnyTimer = systimer.alarm0;

    esp_hal_embassy::init([timer0, timer1, timer2]);

    // ...
}

Note that you only have to convert into AnyTimer if you want to use multiple timers.