Jark / FTDISample

Note: As of version 10556.0 the ftdi driver does no longer seem to work. A sample application showcasing the FTDI D2XX driver use in Windows Universal projects (UWP). This sample is tested on the Raspberry PI 2 with Windows IOT installed and a FTDI FT232R usb-to-serial adapter.
Apache License 2.0
22 stars 3 forks source link

Multiple connections #5

Closed luka1995 closed 8 years ago

luka1995 commented 8 years ago

It is possible to connect multiple FTDI converters?

djaus2 commented 8 years ago

Just off the top of my head: You should get multiple devices listed. You will probably need to recode a little to add an array of loaded devices rather than one specific. Shouldn't be too hard.

PS Watch my blog as I will blog in the next 24hrs with respect to some direct feedback I received a few hours ago about FTDI ARM drivers from Microsoft.. http://embedded101.com/Blogs/David-Jones

Jark commented 8 years ago

Yes, luka1995, it should definitely be possible to connect multiple converters. Simply instantiate one DeviceConnection class per FTDI device you'd like to communicate with.

djaus2 commented 8 years ago

Examining the code:

            private DeviceConnection deviceConnection;
            public DeviceConnection DeviceConnection
            {
                        get { return deviceConnection; }
                        set { deviceConnection = value; OnPropertyChanged(); }
            }

            private async void OnSelectDevice(DeviceNode deviceNode)
            {
                 DeviceConnection newConnection;
                 lock (locker) // make sure we don't create multiple device connections by a trigger happy user
                  {
                      if (DeviceConnection != null)
                      return;

                      var device = ftManager.OpenByDeviceID(deviceNode.DeviceId);
                     newConnection = new DeviceConnection(deviceNode, device);
                     DeviceConnection = newConnection;

As you can see from the code above, as it stands the code only accepts one connection. You need a list or array of DeviceConnection. Should check that each new one isn't already connected and need to sort out things (get the correct one) when disconnecting.

eg.. Make the property a list

Cheers