From 36c909a8e73c76b509695eade306f8878de5d4eb Mon Sep 17 00:00:00 2001
From: Emilio <emilio.corigliano@skywarder.eu>
Date: Sat, 22 Apr 2023 23:34:26 +0200
Subject: [PATCH] [I2C] Now the I2C timings are calculated at initialization
 time (in the constructor)

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

diff --git a/src/shared/drivers/i2c/I2CDriver-f7.cpp b/src/shared/drivers/i2c/I2CDriver-f7.cpp
index c98c0de14..8381d90b2 100644
--- a/src/shared/drivers/i2c/I2CDriver-f7.cpp
+++ b/src/shared/drivers/i2c/I2CDriver-f7.cpp
@@ -444,6 +444,9 @@ void I2CDriver::init()
     // bit resets the peripheral)
     i2c->CR1 = 0;
 
+    // Calling getTimings so that all his static variables are initialized
+    getTimings(I2CDriver::Speed::STANDARD);
+
     // Enabling the peripheral after initialization
     i2c->CR1 |= I2C_CR1_PE;
 }
-- 
GitLab