From 606914b945df50f1bce00058b0106d8e36f065c6 Mon Sep 17 00:00:00 2001 From: Andelf Date: Mon, 7 Oct 2024 16:48:28 +0800 Subject: [PATCH] fix(i2c): add ioc setting to pin --- src/i2c/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/i2c/mod.rs b/src/i2c/mod.rs index e783a79..b6a7d35 100644 --- a/src/i2c/mod.rs +++ b/src/i2c/mod.rs @@ -147,14 +147,15 @@ impl<'d> I2c<'d, Blocking> { ) -> Self { into_ref!(scl, sda); + scl.set_as_ioc_gpio(); + sda.set_as_ioc_gpio(); + #[cfg(not(ip_feature_i2c_support_reset))] loop { // TODO: Fix this strangle control flow use embedded_hal::delay::DelayNs; use riscv::delay::McycleDelay; - scl.set_as_ioc_gpio(); - sda.set_as_ioc_gpio(); scl.set_as_input(); sda.set_as_input(); @@ -224,14 +225,15 @@ impl<'d> I2c<'d, Async> { ) -> Self { into_ref!(scl, sda); + scl.set_as_ioc_gpio(); + sda.set_as_ioc_gpio(); + #[cfg(not(ip_feature_i2c_support_reset))] loop { // TODO: Fix this strangle control flow use embedded_hal::delay::DelayNs; use riscv::delay::McycleDelay; - scl.set_as_ioc_gpio(); - sda.set_as_ioc_gpio(); scl.set_as_input(); sda.set_as_input();