Pico_USB_Tests/src_device/usb_descriptor.h

40 lines
1.2 KiB
C

#ifndef _USB_DESCRIPTOR_H
#define _USB_DESCRIPTOR_H
#include <tusb.h>
#include <pico/usb_reset.h>
// set some example Vendor and Product ID
// the board will use to identify at the host
#define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) )
#define CDC_EXAMPLE_VID 0xCafe
// use _PID_MAP to generate unique PID for each interface
#define CDC_EXAMPLE_PID (0x4100 | _PID_MAP(CDC, 0))
// set to 2.10 so the MS_OS_20_DESCRIPTOR works
#define CDC_EXAMPLE_BCD 0x0210
// String descriptors referenced with .i... in the descriptor tables
enum {
STR_ID_LANGID = 0, // Supported language ID
STR_ID_MANUFACTURER, // Manufacturer
STR_ID_PRODUCT, // Product
STR_ID_SERIAL, // Serials
STR_ID_CDC, // CDC Interface 0
STR_ID_RPI_RESET // RPI Reset interface
};
enum {
ITF_NUM_CDC = 0,
ITF_NUM_RPI_RESET,
ITF_NUM_TOTAL
};
// total length of configuration descriptor
#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN)
// define endpoint numbers
#define EPNUM_CDC_0_NOTIF 0x81 // notification endpoint for CDC 0
#define EPNUM_CDC_0_OUT 0x02 // out endpoint for CDC 0
#define EPNUM_CDC_0_IN 0x82 // in endpoint for CDC 0
#endif // _USB_DESCRIPTOR_H