From c83db2e4f6b4b8d3bbedce67d2156a58023bc432 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 18 Dec 2023 15:34:04 +0100 Subject: [PATCH] fix(wire): reset pins to INPUT_ANALOG when deinit prevent consumption before entering in low power mode Signed-off-by: Frederic Pillon --- libraries/Wire/src/utility/twi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/Wire/src/utility/twi.c b/libraries/Wire/src/utility/twi.c index fbaf092550..2f65b4a1ba 100644 --- a/libraries/Wire/src/utility/twi.c +++ b/libraries/Wire/src/utility/twi.c @@ -804,6 +804,9 @@ void i2c_deinit(i2c_t *obj) HAL_NVIC_DisableIRQ(obj->irqER); #endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx */ HAL_I2C_DeInit(&(obj->handle)); + /* Reset I2C GPIO pins as INPUT_ANALOG */ + pin_function(obj->scl, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)); + pin_function(obj->sda, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)); // Reset I2Cx and disable clock #if defined I2C1_BASE if (obj->i2c == I2C1) {