Esempio n. 1
0
        public void I2CStreamTest()
        {
            Console.WriteLine("Starting I2C data stream test...");

            I2CPreamble pre = new I2CPreamble();

            pre.DeviceAddress = 0xA0;
            pre.PreambleData.Add(0);
            pre.PreambleData.Add(0);
            pre.PreambleData.Add(0xA1);
            pre.StartMask = 4;

            TestI2CFunctionality();

            byte[] StreamData, InitialRead;

            for (int trial = 0; trial < 5; trial++)
            {
                Console.WriteLine("Starting stream...");
                FX3.StartI2CStream(pre, 64, 1000);
                FX3.WaitForStreamCompletion(10000);
                Console.WriteLine("Stream complete. Checking data...");
                InitialRead = FX3.GetI2CBuffer();
                for (int i = 1; i < 1000; i++)
                {
                    StreamData = FX3.GetI2CBuffer();
                    for (int j = 0; j < StreamData.Count(); j++)
                    {
                        Assert.AreEqual(InitialRead[j], StreamData[j], "ERROR: Invalid I2C read back data on buffer " + i.ToString());
                    }
                }
                TestI2CFunctionality();
            }
        }