Skip to content

Commit

Permalink
fix(wire): reset pins to INPUT_ANALOG when deinit
Browse files Browse the repository at this point in the history
prevent consumption before entering in low power mode

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
  • Loading branch information
fpistm committed Dec 18, 2023
1 parent 63d3096 commit c83db2e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/Wire/src/utility/twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c83db2e

Please sign in to comment.