fix: 删除Camera无用读函数
This commit is contained in:
parent
4af7da6344
commit
938ee80979
|
@ -242,33 +242,6 @@ class Camera
|
|||
return result.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取摄像头寄存器
|
||||
/// </summary>
|
||||
/// <param name="registerAddr">寄存器地址</param>
|
||||
/// <returns>读取到的寄存器值</returns>
|
||||
private async ValueTask<Result<byte>> ReadRegister(UInt16 registerAddr)
|
||||
{
|
||||
var i2c = new Peripherals.I2cClient.I2c(this.address, this.port, this.taskID, this.timeout);
|
||||
|
||||
// 地址高低字节
|
||||
var addrBytes = new byte[2];
|
||||
addrBytes[0] = (byte)(registerAddr >> 8);
|
||||
addrBytes[1] = (byte)(registerAddr & 0xFF);
|
||||
|
||||
// 先写寄存器地址
|
||||
var writeResult = await i2c.WriteData(CAM_I2C_ADDR, addrBytes, CAM_PROTO);
|
||||
if (!writeResult.IsSuccessful)
|
||||
return new(writeResult.Error);
|
||||
|
||||
// 再读一个字节
|
||||
var readResult = await i2c.ReadData(CAM_I2C_ADDR, 1, CAM_PROTO);
|
||||
if (!readResult.IsSuccessful)
|
||||
return new(readResult.Error);
|
||||
|
||||
return readResult.Value[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量配置I2C寄存器
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue