We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 917a4fd commit 04e0902Copy full SHA for 04e0902
cores/esp32/esp32-hal-i2c.c
@@ -267,9 +267,17 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
267
i2cResetFiFo(i2c);
268
}
269
270
- i2cSetCmd(i2c, cmdIdx++, I2C_CMD_READ, willRead, false, false, false);
271
- if((len - willRead) > 1) {
272
- i2cSetCmd(i2c, cmdIdx++, I2C_CMD_END, 0, false, false, false);
+ if(willRead){
+ i2cSetCmd(i2c, cmdIdx++, I2C_CMD_READ, willRead, false, false, false);
+ if((len - willRead) > 1) {
273
+ i2cSetCmd(i2c, cmdIdx++, I2C_CMD_END, 0, false, false, false);
274
+ } else {
275
+ willRead++;
276
+ i2cSetCmd(i2c, cmdIdx++, I2C_CMD_READ, 1, true, false, false);
277
+ if(sendStop) {
278
+ i2cSetCmd(i2c, cmdIdx++, I2C_CMD_STOP, 0, false, false, false);
279
+ }
280
281
} else {
282
willRead++;
283
i2cSetCmd(i2c, cmdIdx++, I2C_CMD_READ, 1, true, false, false);
0 commit comments