Browse Source

fix:i2c发送多个reg地址时重复restart了

alienwalker 3 years ago
parent
commit
c81240de79
2 changed files with 2 additions and 11 deletions
  1. 1 1
      application/src/luat_i2c_air105.c
  2. 1 10
      bsp/air105/hal/core_i2c.c

+ 1 - 1
application/src/luat_i2c_air105.c

@@ -61,7 +61,7 @@ int luat_i2c_recv(int id, int addr, void* buff, size_t len) {
     // I2C_MasterXfer(id, I2C_OP_READ, 0, buff, len, 20);
 }
 
-int luat_i2c_xfer(int id, int addr, uint8_t *reg, size_t reg_len, uint8_t *buff, size_t len) {
+int luat_i2c_transfer(int id, int addr, uint8_t *reg, size_t reg_len, uint8_t *buff, size_t len) {
 	if (reg && reg_len) {
 		return I2C_BlockRead(id, addr, reg, reg_len, (uint8_t *)buff, len, 100, NULL, NULL);
 	} else {

+ 1 - 10
bsp/air105/hal/core_i2c.c

@@ -148,16 +148,7 @@ static void I2C_IrqHandle(int32_t IrqLine, void *pData)
 			}
 			else
 			{
-				if ((prvI2C.RegBuf.MaxLen - prvI2C.RegBuf.Pos) > 1)
-				{
-					I2C->IC_DATA_CMD = prvI2C.RegBuf.Data[prvI2C.RegBuf.Pos];
-
-				}
-				else
-				{
-
-					I2C->IC_DATA_CMD = prvI2C.RegBuf.Data[prvI2C.RegBuf.Pos]|I2C_IC_DATA_CMD_RESTART;
-				}
+				I2C->IC_DATA_CMD = prvI2C.RegBuf.Data[prvI2C.RegBuf.Pos];
 				prvI2C.RegBuf.Pos++;
 			}
 		}