periph_common/i2c: fix ret code handling
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
This commit is contained in:
parent
6f25886d77
commit
39cb0e2bdb
@ -38,7 +38,7 @@ int i2c_read_regs(i2c_t dev, uint16_t addr, uint16_t reg,
|
||||
/* First set ADDR and register with no stop */
|
||||
err = i2c_write_bytes(dev, addr, ®, (flags & I2C_REG16) ? 2 : 1,
|
||||
flags & I2C_NOSTOP );
|
||||
if (err != I2C_ACK) {
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
/* Then get the data from device */
|
||||
@ -70,7 +70,7 @@ int i2c_write_regs(i2c_t dev, uint16_t addr, uint16_t reg,
|
||||
/* First set ADDR and register with no stop */
|
||||
err = i2c_write_bytes(dev, addr, ®, (flags & I2C_REG16) ? 2 : 1,
|
||||
flags & I2C_NOSTOP );
|
||||
if (err != I2C_ACK) {
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
/* Then write data to the device */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user