Skip to content

Commit d467f7d

Browse files
authored
Merge pull request #4012 from monkiineko/master
STM32: Correct I2C master error handling
2 parents 91ecc52 + 2eb4048 commit d467f7d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

targets/TARGET_STM/i2c_api.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,10 @@ void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c){
904904

905905
#if DEVICE_I2CSLAVE
906906
/* restore slave address */
907-
i2c_slave_address(obj, 0, address, 0);
907+
if (address != 0) {
908+
obj_s->slave = 1;
909+
i2c_slave_address(obj, 0, address, 0);
910+
}
908911
#endif
909912

910913
/* Keep Set event flag */

0 commit comments

Comments
 (0)