xous-core/emulation/peripherals/LSM6DS3.cs
Sean Cross 4b3d1503e7 renode: place all peripherals under "Betrusted" ns
Give a "Betrusted" namespace to all of the peripherals. This will enable
us to upstream various modules without breaking compatibility with our
own versions of these peripherals.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-10-20 22:19:40 +08:00

53 lines
1.2 KiB
C#

//
// Copyright (c) 2010-2021 Antmicro
//
// This file is licensed under the MIT License.
// Full license text is available in 'licenses/MIT.txt'.
//
using Antmicro.Renode.Logging;
using Antmicro.Renode.Utilities;
using Antmicro.Renode.Peripherals.I2C;
namespace Antmicro.Renode.Peripherals.Mocks.Betrusted
{
public class LSM6DS3 : II2CPeripheral
{
public LSM6DS3()
{
Reset();
}
public void Write(byte[] data)
{
this.Log(LogLevel.Debug, "Written {0} bytes of data: {1}", data.Length, Misc.PrettyPrintCollectionHex(data));
buffer = data;
}
public byte[] Read(int count = 1)
{
this.Log(LogLevel.Debug, "Reading {0} bytes", count);
var result = new byte[count];
for(var i = 0; i < result.Length; i++)
{
result[i] = (i < buffer.Length)
? buffer[i]
: (byte)0;
}
return result;
}
public void FinishTransmission()
{
this.Log(LogLevel.Debug, "Finishing transmission");
}
public void Reset()
{
buffer = new byte[0];
}
private byte[] buffer;
}
}