cleanup read commands
This commit is contained in:
parent
04e0902ca6
commit
b86fb30b1d
@ -269,6 +269,8 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
|
|||||||
|
|
||||||
if(willRead){
|
if(willRead){
|
||||||
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_READ, willRead, false, false, false);
|
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_READ, willRead, false, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
if((len - willRead) > 1) {
|
if((len - willRead) > 1) {
|
||||||
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_END, 0, false, false, false);
|
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_END, 0, false, false, false);
|
||||||
} else {
|
} else {
|
||||||
@ -278,13 +280,6 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
|
|||||||
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_STOP, 0, false, false, false);
|
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_STOP, 0, false, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
willRead++;
|
|
||||||
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_READ, 1, true, false, false);
|
|
||||||
if(sendStop) {
|
|
||||||
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_STOP, 0, false, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Clear Interrupts
|
//Clear Interrupts
|
||||||
i2c->dev->int_clr.val = 0xFFFFFFFF;
|
i2c->dev->int_clr.val = 0xFFFFFFFF;
|
||||||
|
Loading…
Reference in New Issue
Block a user