MPLAB Harmony USB Stack
|
This function closes an opened handle to an instance of the USB device layer, invalidating the handle.
void USB_DEVICE_Close( USB_DEVICE_HANDLE usbDeviceHandle );
The USB_DEVICE_Initialize function must have been called for the specified device layer instance. USB_DEVICE_Open must have been called to obtain a valid opened device handle.
Parameters |
Description |
handle |
A valid open-instance handle, returned from USB_DEVICE_Open |
None
After calling this routine, the handle passed in "usbDevHandle" must not be used with any of the remaining driver routines. A new handle must be obtained by calling USB_DEVICE_Open() before the client may use the device layer again.
USB_DEVICE_HANDLE usbDeviceHandle; // Before opening a handle, USB device must have been initialized // by calling USB_DEVICE_Initialize(). usbDeviceHandle = USB_DEVICE_Open( USB_DEVICE_INDEX_0 ); if(USB_DEVICE_HANDLE_INVALID == usbDeviceHandle) { //Failed to open handle. } //................. //................. // User's code //................. //................. // Close handle USB_DEVICE_Close( usbDevHandle );
MPLAB Harmony USB Stack
|