mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: targets/TARGET_STM/i2c_api.c
- Revision:
- 189:f392fc9709a3
- Parent:
- 188:bcfe06ba3d64
--- a/targets/TARGET_STM/i2c_api.c Thu Nov 08 11:46:34 2018 +0000 +++ b/targets/TARGET_STM/i2c_api.c Wed Feb 20 22:31:08 2019 +0000 @@ -590,17 +590,17 @@ #endif // Disable reload mode handle->Instance->CR2 &= (uint32_t)~I2C_CR2_RELOAD; - + // Ensure the transmission is started before sending a stop if ((handle->Instance->CR2 & (uint32_t)I2C_CR2_RD_WRN) == 0) { - timeout = FLAG_TIMEOUT; - while (!__HAL_I2C_GET_FLAG(handle, I2C_FLAG_TXIS)) { - if ((timeout--) == 0) { - return I2C_ERROR_BUS_BUSY; - } - } + timeout = FLAG_TIMEOUT; + while (!__HAL_I2C_GET_FLAG(handle, I2C_FLAG_TXIS)) { + if ((timeout--) == 0) { + return I2C_ERROR_BUS_BUSY; + } + } } - + // Generate the STOP condition handle->Instance->CR2 |= I2C_CR2_STOP;