mbed w/ spi bug fig
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/i2c_api.c
- Revision:
- 247:135e3186a638
- Parent:
- 227:7bd0639b8911
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/i2c_api.c Tue Jul 01 06:15:07 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/i2c_api.c Tue Jul 01 15:00:09 2014 +0100 @@ -219,8 +219,6 @@ int timeout; int value; - if (length == 0) return 0; - // Configure slave address, nbytes, reload, end mode and start or stop generation I2C_TransferHandling(i2c, address, length, I2C_SoftEnd_Mode, I2C_Generate_Start_Read); @@ -233,7 +231,7 @@ timeout = FLAG_TIMEOUT; while (!I2C_GetFlagStatus(i2c, I2C_FLAG_TC)) { timeout--; - if (timeout == 0) return 0; + if (timeout == 0) return -1; } if (stop) i2c_stop(obj); @@ -247,8 +245,6 @@ int timeout; int count; - if (length == 0) return 0; - // Configure slave address, nbytes, reload, end mode and start generation I2C_TransferHandling(i2c, address, length, I2C_SoftEnd_Mode, I2C_Generate_Start_Write); @@ -260,7 +256,7 @@ timeout = FLAG_TIMEOUT; while (!I2C_GetFlagStatus(i2c, I2C_FLAG_TC)) { timeout--; - if (timeout == 0) return 0; + if (timeout == 0) return -1; } if (stop) i2c_stop(obj); @@ -278,7 +274,7 @@ while (I2C_GetFlagStatus(i2c, I2C_ISR_RXNE) == RESET) { timeout--; if (timeout == 0) { - return 0; + return -1; } }