Skip to content

Commit 7f6ff7e

Browse files
authored
Merge pull request #14434 from jeromecoutant/PR_WB_I2C
STM32 I2C : correct deinit
2 parents 0742135 + 34f02ff commit 7f6ff7e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

targets/TARGET_STM/i2c_api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void i2c_init_internal(i2c_t *obj, const i2c_pinmap_t *pinmap)
300300
obj_s->event_i2cIRQ = I2C1_EV_IRQn;
301301
obj_s->error_i2cIRQ = I2C1_ER_IRQn;
302302

303-
#if defined(TARGET_STM32WL)
303+
#if defined(TARGET_STM32WL) || defined(TARGET_STM32WB)
304304
/* In Stop2 mode, I2C1 and I2C2 instances are powered down (only I2C3 register content is kept) */
305305
sleep_manager_lock_deep_sleep();
306306
#endif
@@ -395,7 +395,7 @@ void i2c_deinit_internal(i2c_t *obj)
395395
#if defined I2C1_BASE
396396
if (obj_s->i2c == I2C_1) {
397397
__HAL_RCC_I2C1_CLK_DISABLE();
398-
#if defined(TARGET_STM32WL)
398+
#if defined(TARGET_STM32WL) || defined(TARGET_STM32WB)
399399
sleep_manager_unlock_deep_sleep();
400400
#endif
401401
}
@@ -424,8 +424,8 @@ void i2c_deinit_internal(i2c_t *obj)
424424
}
425425
#endif
426426

427-
pin_mode(obj_s->sda, PullNone);
428-
pin_mode(obj_s->scl, PullNone);
427+
pin_function(obj_s->sda, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
428+
pin_function(obj_s->scl, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
429429

430430
obj_s->sda = NC;
431431
obj_s->scl = NC;

0 commit comments

Comments
 (0)