From 3adb0b288ee26dd870e7d1a26492db4447124527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Sat, 23 Nov 2024 16:20:14 +0100 Subject: [PATCH] 0.21 Migration guide fixes (#2592) --- esp-hal/MIGRATING-0.21.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esp-hal/MIGRATING-0.21.md b/esp-hal/MIGRATING-0.21.md index 709a22239..fe1bded24 100644 --- a/esp-hal/MIGRATING-0.21.md +++ b/esp-hal/MIGRATING-0.21.md @@ -99,8 +99,8 @@ The constructors no longer take pins. Use `with_sda` and `with_scl` instead. ```diff -use esp_hal::i2c::I2c; +use esp_hal::i2c::{Config, I2c}; --let i2c = I2c::new_with_timeout(peripherals.I2C0, io.pins.gpio4, io.pins.gpio5, 100.kHz(), timeout); -+I2c::new_with_config( +-let i2c = I2c::new_with_timeout(peripherals.I2C0, sda, scl, 100.kHz(), timeout); ++let i2c = I2c::new( + peripherals.I2C0, + { + let mut config = Config::default(); @@ -109,8 +109,8 @@ The constructors no longer take pins. Use `with_sda` and `with_scl` instead. + config + }, +) -+.with_sda(io.pins.gpio4) -+.with_scl(io.pins.gpio5); ++.with_sda(sda) ++.with_scl(scl); ``` ### The calculation of I2C timeout has changed