Skip to content

Commit c83db2e

Browse files
committed
fix(wire): reset pins to INPUT_ANALOG when deinit
prevent consumption before entering in low power mode Signed-off-by: Frederic Pillon <[email protected]>
1 parent 63d3096 commit c83db2e

File tree

1 file changed

+3
-0
lines changed
  • libraries/Wire/src/utility

1 file changed

+3
-0
lines changed

Diff for: libraries/Wire/src/utility/twi.c

+3
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,9 @@ void i2c_deinit(i2c_t *obj)
804804
HAL_NVIC_DisableIRQ(obj->irqER);
805805
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx */
806806
HAL_I2C_DeInit(&(obj->handle));
807+
/* Reset I2C GPIO pins as INPUT_ANALOG */
808+
pin_function(obj->scl, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
809+
pin_function(obj->sda, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
807810
// Reset I2Cx and disable clock
808811
#if defined I2C1_BASE
809812
if (obj->i2c == I2C1) {

0 commit comments

Comments
 (0)