Description
This function open the connection to the selected by a number (starting from zero) Trenz Electronic USB FX2 device number (Cypress driver derivative and VID = 0xbd0, PID=0x0300) connected to a host computer's USB port.
Description of internal procedure
This function takes (a null initialized or an already initialized) USB device list, (re-)creates a USB device list , searches for Trenz Electronic USB FX2 devices (Cypress driver derivative and VID = 0xbd0, PID=0x0300) and counts them.
If no device is attached, TE_USB_FX2_USB_device (CyUSBDevice type) is initialized to null. If one or more devices are attached and
- if 0 ≤ CardNumber ≤ (number of attached devices – 1), then TE_USB_FX2_USBDevice (CyUSBDevice type) will point to and will be initialized according to the selected device.
- if CardNumber ≥ number of attached devices, then TE_USB_FX2_USBDevice (CyUSBDevice type) is initialized to null.
A more intuitive name for this function would have been TE_USB_FX2_SelectCard().
Info |
---|
A more intuitive name for this function would have been TE_USB_FX2_SelectCard(). |
Use of the code
Declaration
Code Block |
---|
|
public static bool TE_USB_FX2_Open(ref CyUSBDevice TE_USB_FX2_USBDevice, ref USBDeviceList USBdevList, int CardNumber); |
Function Call
Your application program shall call this function like this:
Code Block |
---|
|
TE_USB_FX2.TE_USB_FX2.TE_USB_FX2_Open(ref TE_USB_FX2_USBDevice, ref USBdevList, CardNumber); |
Parameters
Code Block |
---|
|
ref CyUSBDevice TE_USB_FX2_USBDevice |
TE_USB_FX2_USBDevice is the module selected by this function. This is the most useful value returned by this function. This parameter is passed by reference (ref). See pages 70-93 of CyUSB.NET.pdf (Cypress CyUSB .NET DLL Programmer's Reference).
Code Block |
---|
|
ref USBDeviceList USBdevList |
USBDeviceList is a type defined in CyUSB.dll. USBdevList is the list of devices served by the CyUSB.sys driver (or a derivative like TE_USB_FX2.sys). This parameter is passed by reference (ref). See page 139-140 of CyUSB.NET.pdf (Cypress CyUSB .NET DLL Programmer's Reference)
This is the number of the selected Trenz Electronic USB FX2 device.
Return Value
bool : logical type
This function returns true if it is able to find the module selected by CardNumber. If unable to do so, it returns false.