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 applied 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();
}