1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #17380 from qmk/bind_extra_usb_config

usbus: Bind extra USB config
This commit is contained in:
benpicco 2022-01-09 17:58:38 +01:00 committed by GitHub
commit c18c56aa03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -152,6 +152,13 @@ extern "C" {
#define CONFIG_USB_SELF_POWERED (0)
#endif
/**
* @brief USB peripheral setting to indicate remote wakeup capability.
*/
#ifndef CONFIG_USB_REM_WAKEUP
#define CONFIG_USB_REM_WAKEUP (0)
#endif
/**
* @brief USB device max power draw in mA, between 0 and 500mA
*/

View File

@ -261,6 +261,9 @@ size_t usbus_fmt_descriptor_conf(usbus_t *usbus)
if (CONFIG_USB_SELF_POWERED) {
conf.attributes |= USB_CONF_ATTR_SELF_POWERED;
}
if (CONFIG_USB_REM_WAKEUP) {
conf.attributes |= USB_CONF_ATTR_REM_WAKEUP;
}
/* TODO: upper bound */
/* USB max power is reported in increments of 2 mA */
conf.max_power = CONFIG_USB_MAX_POWER / 2;
@ -286,6 +289,7 @@ size_t usbus_fmt_descriptor_dev(usbus_t *usbus)
desc.max_packet_size = CONFIG_USBUS_EP0_SIZE;
desc.vendor_id = CONFIG_USB_VID;
desc.product_id = CONFIG_USB_PID;
desc.bcd_device = CONFIG_USB_PRODUCT_BCDVERSION;
desc.manufacturer_idx = usbus->manuf.idx;
desc.product_idx = usbus->product.idx;
desc.serial_idx = usbus->serial.idx;