mirror of https://github.com/ARMmbed/mbed-os.git
STM32: Remove i2c_read() and i2c_write() redirects to HAL_I2C_IsDeviceReady()
Some I2C devices require specific zero length read/write sequences which the HAL_I2C_IsDeviceReady() redirect interferes with. After Removing these redirects, it was confirmed that zero length reads and writes would both still work correctly for detecting presence/absence of an I2C device on a bus.pull/4717/head
parent
1af8aef5dc
commit
251459e8aa
|
|
@ -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;
|
||||
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) ||
|
||||
(obj_s->XferOperation == I2C_LAST_FRAME)) {
|
||||
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;
|
||||
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) ||
|
||||
(obj_s->XferOperation == I2C_LAST_FRAME)) {
|
||||
if (stop)
|
||||
|
|
|
|||
Loading…
Reference in New Issue