Пример #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine(FtdiInventory.DeviceListInfo());

            var ftDeviceInfo = FtdiInventory.GetDevices();

            if (ftDeviceInfo.Length == 0)
            {
                Console.WriteLine("No Device");
                Console.ReadKey();
                return;
            }
            var firstSerial = ftDeviceInfo.FirstOrDefault().SerialNumber;

            MpsseDevice.MpsseParams mpsseParams = new MpsseDevice.MpsseParams
            {
                Latency      = 16,
                ReadTimeout  = 50,
                WriteTimeout = 50,
                clockDevisor = 49 * 6
            };

            using (MpsseDevice mpsse = new FT232H(firstSerial, mpsseParams))
            {
                Console.WriteLine("MPSSE init success with clock frequency {0:0.0} Hz", mpsse.ClockFrequency);

                var i2c  = new I2cBus(mpsse);
                var gpio = new Gpio(mpsse);

                Selector(i2c, gpio);
            }
        }
Пример #2
0
        public static string GetFirstSerial()
        {
            var ftDeviceInfo = FtdiInventory.GetDevices();

            Assert.IsNotNull(ftDeviceInfo, "No Devices found");
            var firstDevice = ftDeviceInfo?.FirstOrDefault()?.SerialNumber;

            Assert.IsNotNull(firstDevice, "No Valid Serial Number");
            return(firstDevice);
        }