[HAL][I2C] Clear ACK bit once 3 bytes to read remain to be able to send the NACK once the transfer ends
diff --git a/Src/stm32f4xx_hal_i2c.c b/Src/stm32f4xx_hal_i2c.c
index 0c9e69d..02615cb 100644
--- a/Src/stm32f4xx_hal_i2c.c
+++ b/Src/stm32f4xx_hal_i2c.c
@@ -1374,6 +1374,13 @@
 
         if (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BTF) == SET)
         {
+
+          if (hi2c->XferSize == 3U)
+          {
+            /* Disable Acknowledge */
+            CLEAR_BIT(hi2c->Instance->CR1, I2C_CR1_ACK);
+          }
+
           /* Read data from DR */
           *hi2c->pBuffPtr = (uint8_t)hi2c->Instance->DR;