In this use case, the USB device BUS power feature is enabled.
This feature requires a correct power consumption management.
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_BUS_POWERED)
#define UDC_SUSPEND_EVENT() user_callback_suspend_action()
extern void user_callback_suspend_action(void)
#define UDC_RESUME_EVENT() user_callback_resume_action()
extern void user_callback_resume_action(void)
Add to application C-file:
void user_callback_suspend_action(void)
{
}
void user_callback_resume_action(void)
{
}
Workflow
- Ensure that conf_usb.h is available and contains the following parameters:
#define USB_DEVICE_ATTR (USB_CONFIG_ATTR_BUS_POWERED)
#define UDC_SUSPEND_EVENT() user_callback_suspend_action()
extern void user_callback_suspend_action(void);
#define UDC_RESUME_EVENT() user_callback_resume_action()
extern void user_callback_resume_action(void);
- Reduce power consumption in suspend mode (max. 2.5mA on Vbus):
void user_callback_suspend_action(void)
{
turn_off_components();
}