mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/i2c_api.c
- Revision:
- 247:135e3186a638
- Parent:
- 227:7bd0639b8911
- Child:
- 305:1f0269907d8b
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/i2c_api.c Tue Jul 01 06:15:07 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/i2c_api.c Tue Jul 01 15:00:09 2014 +0100 @@ -178,8 +178,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); @@ -192,7 +190,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); @@ -205,8 +203,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); @@ -218,7 +214,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); @@ -236,7 +232,7 @@ while (I2C_GetFlagStatus(i2c, I2C_ISR_RXNE) == RESET) { timeout--; if (timeout == 0) { - return 0; + return -1; } }