emulation: ec: i2c: allow reading multiple registers

Previously, the code would only allow for reading one register at a
time. This caused that one register to be duplicated repeatedly.

As a result, readings such as Voltage were incorrect.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2022-04-20 21:26:58 +08:00
parent 6d294c97c5
commit cd19fcba57

View file

@ -258,8 +258,8 @@ namespace Antmicro.Renode.Peripherals.I2C
this.Log(LogLevel.Error, "selectedSlave is NULL!"); this.Log(LogLevel.Error, "selectedSlave is NULL!");
return; return;
} }
if (dataFromSlave.Count == 0) // if (dataFromSlave.Count == 0)
{ // {
foreach (var b in selectedSlave.Read()) foreach (var b in selectedSlave.Read())
{ {
dataFromSlave.Enqueue(b); dataFromSlave.Enqueue(b);
@ -271,7 +271,7 @@ namespace Antmicro.Renode.Peripherals.I2C
receiveBuffer.Value = 0; receiveBuffer.Value = 0;
return; return;
} }
} // }
if (receiveBuffer == null) { if (receiveBuffer == null) {
this.Log(LogLevel.Error, "receiveBuffer is NULL!"); this.Log(LogLevel.Error, "receiveBuffer is NULL!");