您好,
请问我用C# 呼叫 CH341ReadI2C 时,发现即使是不存在的 i2c slave address (mDevAddr),CH341ReadI2C 也回应 True
只是读到的值为0xFF,请问如何让CH341ReadI2C 在 I2C NACK 时,能回应 False 呢?
谢谢
try
{
byte mDevAddr = Convert.ToByte(args[0], 16);
byte mDataAddr = Convert.ToByte(args[1], 16);
byte mData = 0;
if (CH341DLL.CH341ReadI2C(mIndex, mDevAddr, mDataAddr, ref mData))
{
// Return the read data in hexadecimal format
string verifyArgs = $"{args[0]} {args[1]}";
Console.WriteLine($"{mDevAddr:X2}:{mDataAddr:X2} = {mData:X2}");
return $"{mData:X2}";
}
else
{
return "I2C read data failed.";
}
}