USB Libraries Help > USB Device Libraries > USB Device Layer Library > Library Interface > c) Device Power State Management Functions > USB_DEVICE_IsSuspended Function
MPLAB Harmony USB Stack
USB_DEVICE_IsSuspended Function

This function returns true is the device is presently in suspended state. The application can use this function in conjunction with the USB_DEVICE_StateGet function to obtain the detailed state of the device (such as addressed and suspended, configured and suspended etc.). The Device Layer also provides the macro USB_DEVICE_EVENT_SUSPENDED event to indicate entry into suspend state.

C
bool USB_DEVICE_IsSuspended(
    USB_DEVICE_HANDLE usbDeviceHandle
);
Preconditions

The USB Device Layer must have been initialized and opened before calling this function.

Parameters
Parameters 
Description 
usbDeviceHandle 
Pointer to the Device Layer Handle that is returned from USB_DEVICE_Open 
Returns

Returns true if the device is suspended.

Remarks

None.

Example
// This code example shows how the application
// can find out if the device is in a configured but suspended state.

if(USB_DEVICE_IsSuspended(usbDeviceHandle))
{
    // Device is in a suspended state.

    if(USB_DEVICE_STATE_CONFIGURED == USB_DEVICE_StateGet(usbDeviceHandle))
    {
        // This means the device is in configured and suspended state.
        
    }
}