mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #4717 from monkiineko/master
STM32: Remove i2c_read() and i2c_write() redirects to HAL_I2C_IsDeviceReady()pull/4803/head
commit
57a4c95d2e
|
@ -743,13 +743,6 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
|
||||||
int count = I2C_ERROR_BUS_BUSY, ret = 0;
|
int count = I2C_ERROR_BUS_BUSY, ret = 0;
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
if((length == 0) || (data == 0)) {
|
|
||||||
if(HAL_I2C_IsDeviceReady(handle, address, 1, 10) == HAL_OK)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return I2C_ERROR_BUS_BUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((obj_s->XferOperation == I2C_FIRST_AND_LAST_FRAME) ||
|
if ((obj_s->XferOperation == I2C_FIRST_AND_LAST_FRAME) ||
|
||||||
(obj_s->XferOperation == I2C_LAST_FRAME)) {
|
(obj_s->XferOperation == I2C_LAST_FRAME)) {
|
||||||
if (stop)
|
if (stop)
|
||||||
|
@ -802,13 +795,6 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
|
||||||
int count = I2C_ERROR_BUS_BUSY, ret = 0;
|
int count = I2C_ERROR_BUS_BUSY, ret = 0;
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
if((length == 0) || (data == 0)) {
|
|
||||||
if(HAL_I2C_IsDeviceReady(handle, address, 1, 10) == HAL_OK)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return I2C_ERROR_BUS_BUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((obj_s->XferOperation == I2C_FIRST_AND_LAST_FRAME) ||
|
if ((obj_s->XferOperation == I2C_FIRST_AND_LAST_FRAME) ||
|
||||||
(obj_s->XferOperation == I2C_LAST_FRAME)) {
|
(obj_s->XferOperation == I2C_LAST_FRAME)) {
|
||||||
if (stop)
|
if (stop)
|
||||||
|
|
Loading…
Reference in New Issue