Ability to set USB device as self powered device (#1105)
This commit is contained in:
parent
05c3f22879
commit
885bd922cf
@ -102,6 +102,11 @@
|
||||
#define PICO_STDIO_USB_CONNECTION_WITHOUT_DTR 0
|
||||
#endif
|
||||
|
||||
// PICO_CONFIG: PICO_STDIO_USB_DEVICE_SELF_POWERED, Set USB device as self powered device, type=bool, default=0, group=pico_stdio_usb
|
||||
#ifndef PICO_STDIO_USB_DEVICE_SELF_POWERED
|
||||
#define PICO_STDIO_USB_DEVICE_SELF_POWERED 0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -54,7 +54,13 @@
|
||||
#else
|
||||
#define USBD_DESC_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_RPI_RESET_DESC_LEN)
|
||||
#endif
|
||||
#if !PICO_STDIO_USB_DEVICE_SELF_POWERED
|
||||
#define USBD_CONFIGURATION_DESCRIPTOR_ATTRIBUTE (0)
|
||||
#define USBD_MAX_POWER_MA (250)
|
||||
#else
|
||||
#define USBD_CONFIGURATION_DESCRIPTOR_ATTRIBUTE TUSB_DESC_CONFIG_ATT_SELF_POWERED
|
||||
#define USBD_MAX_POWER_MA (1)
|
||||
#endif
|
||||
|
||||
#define USBD_ITF_CDC (0) // needs 2 interfaces
|
||||
#if !PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
|
||||
@ -102,7 +108,7 @@ static const tusb_desc_device_t usbd_desc_device = {
|
||||
|
||||
static const uint8_t usbd_desc_cfg[USBD_DESC_LEN] = {
|
||||
TUD_CONFIG_DESCRIPTOR(1, USBD_ITF_MAX, USBD_STR_0, USBD_DESC_LEN,
|
||||
0, USBD_MAX_POWER_MA),
|
||||
USBD_CONFIGURATION_DESCRIPTOR_ATTRIBUTE, USBD_MAX_POWER_MA),
|
||||
|
||||
TUD_CDC_DESCRIPTOR(USBD_ITF_CDC, USBD_STR_CDC, USBD_CDC_EP_CMD,
|
||||
USBD_CDC_CMD_MAX_SIZE, USBD_CDC_EP_OUT, USBD_CDC_EP_IN, USBD_CDC_IN_OUT_MAX_SIZE),
|
||||
|
Loading…
Reference in New Issue
Block a user