1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/stm32: Fix read bytes flag for i2c_2

This commit stops a repeated start read which causes slave bus lockup
When trying to do a repeaded start i2c_read_bytes it returns -EOPNOTSUPP error
This commit is contained in:
MrKevinWeiss 2019-08-14 16:26:22 +02:00
parent 414df99a4c
commit fb38cf37fd

View File

@ -218,6 +218,10 @@ int i2c_read_bytes(i2c_t dev, uint16_t address, void *data, size_t length,
I2C_TypeDef *i2c = i2c_config[dev].dev;
DEBUG("[i2c] read_bytes: Starting\n");
/* Do not support repeated start reading */
if ((i2c->SR2 & I2C_SR2_BUSY) && !(flags & I2C_NOSTART)) {
return -EOPNOTSUPP;
}
int ret = _start(i2c, (address << 1) | I2C_FLAG_READ, flags, length);
if (ret < 0) {
if (ret == -ETIMEDOUT) {