mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
Revision 12:7ebf5ad709a3, committed 2015-10-28
- Comitter:
- mbed_official
- Date:
- Wed Oct 28 13:00:10 2015 +0000
- Parent:
- 11:f10b285e3846
- Child:
- 13:da2ea05f91cf
- Commit message:
- Synchronized with git revision e7e5893c2045db1eeb19a0a08b6eb3e219db778f
Full URL: https://github.com/mbedmicro/mbed/commit/e7e5893c2045db1eeb19a0a08b6eb3e219db778f/
[STM32F4xx] Remove eventual pending stop bit before start on I2C
Changed in this revision
| targets/hal/TARGET_STM/TARGET_STM32F4/i2c_api.c | Show annotated file Show diff for this revision Revisions of this file |
--- a/targets/hal/TARGET_STM/TARGET_STM32F4/i2c_api.c Wed Oct 28 10:00:10 2015 +0000
+++ b/targets/hal/TARGET_STM/TARGET_STM32F4/i2c_api.c Wed Oct 28 13:00:10 2015 +0000
@@ -100,7 +100,7 @@
void i2c_frequency(i2c_t *obj, int hz)
{
- MBED_ASSERT((hz != 0) && (hz <= 400000));
+ MBED_ASSERT((hz > 0) && (hz <= 400000));
I2cHandle.Instance = (I2C_TypeDef *)(obj->i2c);
int timeout;
@@ -135,8 +135,8 @@
// Clear Acknowledge failure flag
__HAL_I2C_CLEAR_FLAG(&I2cHandle, I2C_FLAG_AF);
- // Generate the START condition
- i2c->CR1 |= I2C_CR1_START;
+ // Generate the START condition and remove an eventual pending STOP bit
+ i2c->CR1 = ((i2c->CR1 & ~I2C_CR1_STOP) | I2C_CR1_START);
// Wait the START condition has been correctly sent
timeout = FLAG_TIMEOUT;
