Skip to content

Commit e3bf930

Browse files
committed
Revert "chore: copy fix to esp32xx"
This reverts commit 6cd0c00.
1 parent 6cd0c00 commit e3bf930

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/machine/machine_esp32xx_i2c.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func (i2c *I2C) transmit(addr uint16, cmd []i2cCommand, timeoutMS int) error {
186186
timeoutNS := int64(timeoutMS) * 1000000
187187
needAddress := true
188188
needRestart := false
189+
readLast := false
189190
var readTo []byte
190191
for cmdIdx, reg := 0, &i2c.Bus.COMD0; cmdIdx < len(cmd); {
191192
c := &cmd[cmdIdx]
@@ -253,6 +254,7 @@ func (i2c *I2C) transmit(addr uint16, cmd []i2cCommand, timeoutMS int) error {
253254
reg = nextAddress(reg)
254255
}
255256
if split {
257+
readLast = true
256258
reg.Set(i2cCMD_READLAST | 1)
257259
reg = nextAddress(reg)
258260
readTo = c.data[c.head : c.head+bytes+1] // read bytes + 1 last byte
@@ -283,7 +285,7 @@ func (i2c *I2C) transmit(addr uint16, cmd []i2cCommand, timeoutMS int) error {
283285
}
284286
}
285287
switch {
286-
case mask&esp.I2C_INT_STATUS_NACK_INT_ST_Msk != 0:
288+
case mask&esp.I2C_INT_STATUS_NACK_INT_ST_Msk != 0 && !readLast:
287289
return errI2CAckExpected
288290
case mask&esp.I2C_INT_STATUS_TIME_OUT_INT_ST_Msk != 0:
289291
if readTo != nil {

0 commit comments

Comments
 (0)