public void OpenCloseTest() { using (MpsseDevice mpsse = new FT2232D(FtdiHelper.GetFirstSerial())) { SpiDevice spi = new SpiDevice(mpsse); } }
public void TransmitTest() { using (MpsseDevice mpsse = new FT2232D(FtdiHelper.GetFirstSerial())) { SpiDevice spi = new SpiDevice(mpsse); byte[] tData = { 0x0D, 0x01, 0x0F }; spi.write(tData); } }
public void LoopbackTest() { using (MpsseDevice mpsse = new FT2232D(FtdiHelper.GetFirstSerial())) { SpiDevice spi = new SpiDevice(mpsse); mpsse.Loopback = true; byte[] tData = { 0x0A, 0x01, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0xFF }; byte[] rData = spi.readWrite(tData); Assert.IsTrue(tData.SequenceEqual(rData)); } }
public void OpenCloseTest() { MpsseDevice.MpsseParams mpsseParams = new MpsseDevice.MpsseParams { Latency = 16, ReadTimeout = 50, WriteTimeout = 50, clockDevisor = 49 * 6 }; using (MpsseDevice mpsse = new FT232H(FtdiHelper.GetFirstSerial(), mpsseParams)) { Console.WriteLine("MPSSE init success with clock frequency {0:0.0} Hz", mpsse.ClockFrequency); var i2c = new I2cBus(mpsse); } }
public void LoopbackBigTest() { Random r = new Random(); const uint size = 60000; using (MpsseDevice mpsse = new FT2232D(FtdiHelper.GetFirstSerial())) { SpiDevice spi = new SpiDevice(mpsse); mpsse.Loopback = true; byte[] tData = new byte[size]; r.NextBytes(tData); byte[] rData = spi.readWrite(tData); Assert.IsTrue(tData.SequenceEqual(rData)); } }