From f9523ce602c92530057041c1bb940a05f15e0bb9 Mon Sep 17 00:00:00 2001
From: EmilioCorigliano <emilio.corigliano@mail.polimi.it>
Date: Thu, 20 Apr 2023 01:10:04 +0200
Subject: [PATCH] [I2C] Updated scl/sda pin modes to embed pull-up in f7 driver

---
 src/shared/drivers/i2c/I2CDriver-f7.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shared/drivers/i2c/I2CDriver-f7.cpp b/src/shared/drivers/i2c/I2CDriver-f7.cpp
index 2ef687279..13640f202 100644
--- a/src/shared/drivers/i2c/I2CDriver-f7.cpp
+++ b/src/shared/drivers/i2c/I2CDriver-f7.cpp
@@ -356,8 +356,8 @@ I2CDriver::I2CDriver(I2C_TypeDef *i2c, miosix::GpioPin scl, miosix::GpioPin sda)
         // logical values.
         scl.alternateFunction(I2CConsts::I2C_PIN_ALTERNATE_FUNCTION);
         sda.alternateFunction(I2CConsts::I2C_PIN_ALTERNATE_FUNCTION);
-        scl.mode(miosix::Mode::ALTERNATE_OD);
-        sda.mode(miosix::Mode::ALTERNATE_OD);
+        scl.mode(miosix::Mode::ALTERNATE_OD_PULL_UP);
+        sda.mode(miosix::Mode::ALTERNATE_OD_PULL_UP);
     }
 
     // Checking that this particular I2C port hasn't been already instantiated
@@ -642,7 +642,7 @@ void I2CDriver::flushBus()
         // Recovery from the locked state due to a stuck Slave.
         // We bit-bang 16 clocks on the scl line in order to restore pending
         // packets of the slaves.
-        scl.mode(miosix::Mode::OPEN_DRAIN);
+        scl.mode(miosix::Mode::OPEN_DRAIN_PULL_UP);
     }
 
     for (size_t c = 0; c < I2CConsts::N_SCL_BITBANG; c++)
@@ -657,7 +657,7 @@ void I2CDriver::flushBus()
         miosix::FastInterruptDisableLock dLock;
 
         // We set again the scl pin to the correct Alternate function
-        scl.mode(miosix::Mode::ALTERNATE_OD);
+        scl.mode(miosix::Mode::ALTERNATE_OD_PULL_UP);
         scl.alternateFunction(I2CConsts::I2C_PIN_ALTERNATE_FUNCTION);
     }
 
-- 
GitLab