PaulStoffregen 8 年前
父节点
当前提交
b6b42cef5f
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. +10
    -2
      Wire.cpp

+ 10
- 2
Wire.cpp 查看文件

@@ -555,11 +555,19 @@ uint8_t TwoWire::requestFrom(uint8_t address, uint8_t length, uint8_t sendStop)
i2c_wait();
length--;
if (length == 1) I2C0_C1 = I2C_C1_IICEN | I2C_C1_MST | I2C_C1_TXAK;
rxBuffer[count++] = I2C0_D;
if (count < BUFFER_LENGTH) {
rxBuffer[count++] = I2C0_D;
} else {
tmp = I2C0_D;
}
}
i2c_wait();
I2C0_C1 = I2C_C1_IICEN | I2C_C1_MST | I2C_C1_TX;
rxBuffer[count++] = I2C0_D;
if (count < BUFFER_LENGTH) {
rxBuffer[count++] = I2C0_D;
} else {
tmp = I2C0_D;
}
if (sendStop) I2C0_C1 = I2C_C1_IICEN;
rxBufferLength = count;
return count;

正在加载...
取消
保存