CyclePort() public method

Causes the device to be re-enumerated on the USB bus. This is equivalent to unplugging and replugging the device. Also calls FT_Close if FT_CyclePort is successful, so no need to call this separately in the application.
public CyclePort ( ) : FT_STATUS
return FT_STATUS
コード例 #1
0
ファイル: Program.cs プロジェクト: brand7n/FTDIconnect
        static void Main(string[] args)
        {
            program();
            Console.WriteLine("This program contains a software component made available under the GNU Lesser General Public License.  The source code of this component is available here:");
            Console.WriteLine("https://github.com/brand7n/lpc21isp");

            // Create new instance of the FTDI device class
            FTDI myFtdiDevice = new FTDI();

            attention();
            Console.WriteLine("ATTEMPTING TO CONNECT...");
            subdue();


            while (true)
            {
                try
                {
                    open(myFtdiDevice);
                    Thread.Sleep(1000);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    attention();
                    Console.WriteLine("DISCONNECTED.  RESTART OR REATTACH DEVICE.");
                    subdue();
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    myFtdiDevice.CyclePort();
                }
            }
        }