Microchip® Advanced Software Framework

Use USB remote wakeup feature

In this use case, the USB remote wakeup feature is enabled.

Setup Steps

Prior to implement this use case, be sure to have already apply the UDI module "basic use case".

Usage Steps

Example Code

Content of conf_usb.h:

#define USB_DEVICE_ATTR \
(USB_CONFIG_ATTR_REMOTE_WAKEUP | USB_CONFIG_ATTR_..._POWERED)
#define UDC_REMOTEWAKEUP_ENABLE() my_callback_remotewakeup_enable()
extern void my_callback_remotewakeup_enable(void);
#define UDC_REMOTEWAKEUP_DISABLE() my_callback_remotewakeup_disable()
extern void my_callback_remotewakeup_disable(void);

Add to application C-file:

void my_callback_remotewakeup_enable(void)
{
// Enable application wakeup events (e.g. enable GPIO interrupt)
}
void my_callback_remotewakeup_disable(void)
{
// Disable application wakeup events (e.g. disable GPIO interrupt)
}
void my_interrupt_event(void)
{
}

Workflow

  1. Ensure that conf_usb.h is available and contains the following parameters required to enable remote wakeup feature:
    • // Authorizes the remote wakeup feature
      #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_REMOTE_WAKEUP | USB_CONFIG_ATTR_..._POWERED)
    • // Define callback called when the host enables the remotewakeup feature
      #define UDC_REMOTEWAKEUP_ENABLE() my_callback_remotewakeup_enable()
      extern void my_callback_remotewakeup_enable(void);
    • // Define callback called when the host disables the remotewakeup feature
      #define UDC_REMOTEWAKEUP_DISABLE() my_callback_remotewakeup_disable()
      extern void my_callback_remotewakeup_disable(void);
  2. Send a remote wakeup (USB upstream):

In this use case, the USB remote wakeup feature is enabled.

Setup Steps

Prior to implement this use case, be sure to have already applied the UDI module "basic use case".

Usage Steps

Example Code

Content of conf_usb.h:

#define USB_DEVICE_ATTR \
(USB_CONFIG_ATTR_REMOTE_WAKEUP | USB_CONFIG_ATTR_..._POWERED)
#define UDC_REMOTEWAKEUP_ENABLE() my_callback_remotewakeup_enable()
extern void my_callback_remotewakeup_enable(void);
#define UDC_REMOTEWAKEUP_DISABLE() my_callback_remotewakeup_disable()
extern void my_callback_remotewakeup_disable(void);

Add to application C-file:

void my_callback_remotewakeup_enable(void)
{
// Enable application wakeup events (e.g. enable GPIO interrupt)
}
void my_callback_remotewakeup_disable(void)
{
// Disable application wakeup events (e.g. disable GPIO interrupt)
}
void my_interrupt_event(void)
{
}

Workflow

  1. Ensure that conf_usb.h is available and contains the following parameters required to enable the remote wakeup feature:
    // Authorizes the remote wakeup feature
    #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_REMOTE_WAKEUP | USB_CONFIG_ATTR_..._POWERED)
    // Define callback called when the host enables the remotewakeup feature
    #define UDC_REMOTEWAKEUP_ENABLE() my_callback_remotewakeup_enable()
    extern void my_callback_remotewakeup_enable(void);
    // Define callback called when the host disables the remotewakeup feature
    #define UDC_REMOTEWAKEUP_DISABLE() my_callback_remotewakeup_disable()
    extern void my_callback_remotewakeup_disable(void);
  2. Send a remote wakeup (USB upstream):