From cd19fcba570ae861dfd5b6fc2e4e11d24953dab2 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Wed, 20 Apr 2022 21:26:58 +0800 Subject: [PATCH] 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 --- emulation/peripherals/BetrustedEcI2C.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emulation/peripherals/BetrustedEcI2C.cs b/emulation/peripherals/BetrustedEcI2C.cs index f92395c58..69db841f1 100644 --- a/emulation/peripherals/BetrustedEcI2C.cs +++ b/emulation/peripherals/BetrustedEcI2C.cs @@ -258,8 +258,8 @@ namespace Antmicro.Renode.Peripherals.I2C this.Log(LogLevel.Error, "selectedSlave is NULL!"); return; } - if (dataFromSlave.Count == 0) - { + // if (dataFromSlave.Count == 0) + // { foreach (var b in selectedSlave.Read()) { dataFromSlave.Enqueue(b); @@ -271,7 +271,7 @@ namespace Antmicro.Renode.Peripherals.I2C receiveBuffer.Value = 0; return; } - } + // } if (receiveBuffer == null) { this.Log(LogLevel.Error, "receiveBuffer is NULL!");