Download SC5304A Operating & Programming Manual
Transcript
Description:
sc5304a_OpenDevice opens the device and turns on the front panel access LED if
successful. This function returns a handle of USB type to the device for other function
calls.
Function:
Definition:
sc5304a_CloseDevice
int
sc5304a_CloseDevice(deviceHandle *devHandle)
Return:
Input:
Description:
The status of the function
deviceHandle *devHandle
(handle to the device to be closed)
sc5304a_CloseDevice closes the device associated with the device handle and turns off
the access LED of the front panel if it is successful.
Example:
To exercise the functions that open and and close the USB device:
// Declaring
char **deviceList;
deviceHandle devHandle;
int devicesFound;
int i;
// Allocate memory
deviceList = (char**)malloc(sizeof(char*)*MAXDEVICES); // MAXDEVICES=50 serial numbers to search
for (i=0;i<MAXDEVICES; i++)
deviceList[i] = (char*)malloc(sizeof(char)*SCI_SN_LENGTH); // SCI SN has 8 char
devicesFound = sc5304a_SearchDevices(deviceList);
printf("There are %d SignalCore USB devices found. \n", devicesFound);
i=0;
while ( i < numOfDevices)
{
printf(" Device %d has Serial Number: %s \n", i+1, deviceList[i]);
i++;
}
devHandle = sc5304a_OpenDevice(deviceList[0]); // get a handle to the first device on the List
// Free memory
for(i = 0; i<MAXDEVICES;i++) free(deviceList[i]);
free(deviceList);
//
// Do something with the device
//
//Close the device
int status = sc5304a_CloseDevice(devHandle);
SC5304A Operating & Programming Manual
36