clean up, use BLEDIS_MANUFACTURER and BLEDIS_MODEL for USB Manufacturer and Product string

This commit is contained in:
hathach 2019-11-11 15:50:28 +07:00
parent c6d02901b3
commit 8a979d33bc
6 changed files with 18 additions and 61 deletions

View File

@ -67,24 +67,4 @@
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x003B
#define USB_STRING_DESCRIPTORS { \
/* 0: is supported language = English */ \
TUD_DESC_STRCONV(0x0409), \
\
/* 1: Manufacturer */ \
TUD_DESC_STRCONV('E','l','e','c','t','r','o','n','u','t',' ','L','a','b','s'), \
\
/* 2: Product */ \
TUD_DESC_STRCONV('P','a','p','y','r', ' ', 'D','F','U'), \
\
/* 3: Serials TODO use chip ID */ \
usb_desc_str_serial, \
\
/* 4: CDC Interface */ \
TUD_DESC_STRCONV('P','a','p','y','r',' ','S','e','r','i','a','l'), \
\
/* 5: MSC Interface */ \
TUD_DESC_STRCONV('P','a','p','y','r',' ','U','F','2'), \
}
#endif // PPAPYR_H

View File

@ -51,10 +51,10 @@
#define HWFC false
// Used as model string in OTA mode
#define BLEDIS_MANUFACTURER "Adafruit Industries"
#define BLEDIS_MODEL "Feather nRF52832"
#define BLEDIS_MANUFACTURER "Adafruit Industries"
#define BLEDIS_MODEL "Feather nRF52832"
#define UF2_PRODUCT_NAME "Adafruit Feather nRF52832"
#define UF2_INDEX_URL "https://www.adafruit.com/product/3406"
#define UF2_PRODUCT_NAME "Adafruit Feather nRF52832"
#define UF2_INDEX_URL "https://www.adafruit.com/product/3406"
#endif // _FEATHER_NRF52832_H

View File

@ -68,9 +68,9 @@
#define USB_DESC_CDC_ONLY_PID 0x002A
//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "Adafruit Feather nRF52840 Express"
#define UF2_VOLUME_LABEL "FTHR840BOOT"
#define UF2_BOARD_ID "nRF52840-Feather-revD"
#define UF2_INDEX_URL "https://www.adafruit.com/product/4062"
#define UF2_PRODUCT_NAME "Adafruit Feather nRF52840 Express"
#define UF2_VOLUME_LABEL "FTHR840BOOT"
#define UF2_BOARD_ID "nRF52840-Feather-revD"
#define UF2_INDEX_URL "https://www.adafruit.com/product/4062"
#endif // _FEATHER_NRF52840_H

View File

@ -52,7 +52,7 @@ void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16
(void) lun;
const char vid[] = "Adafruit";
const char pid[] = "Bluefruit UF2";
const char pid[] = "nRF UF2";
const char rev[] = "1.0";
memcpy(vendor_id , vid, strlen(vid));

View File

@ -134,42 +134,19 @@ void usb_desc_init(bool cdc_only)
// STRING DESCRIPTORS
//--------------------------------------------------------------------+
#ifndef USB_STRING_DESCRIPTORS
#define USB_STRING_DESCRIPTORS { \
/* 0: is supported language = English */ \
TUD_DESC_STRCONV(0x0409), \
\
/* 1: Manufacturer */ \
TUD_DESC_STRCONV('A','d','a','f','r','u','i','t',' ','I','n','d','u','s','t','r','i','e','s'), \
\
/* 2: Product */ \
TUD_DESC_STRCONV('B','l','u','e','f','r','u','i','t',' ','n','R','F','5','2','8','4','0', ' ', 'D','F','U'), \
\
/* 3: Serials TODO use chip ID */ \
usb_desc_str_serial, \
\
/* 4: CDC Interface */ \
TUD_DESC_STRCONV('B','l','u','e','f','r','u','i','t',' ','S','e','r','i','a','l'), \
\
/* 5: MSC Interface */ \
TUD_DESC_STRCONV('B','l','u','e','f','r','u','i','t',' ','U','F','2'), \
}
#endif
// array of pointer to string descriptors
char const* string_desc_arr [] =
{
(const char[]) { 0x09, 0x04 }, // 0: is supported language is English (0x0409)
"Adafruit Industries", // 1: Manufacturer
"Bluefruit DFU", // 2: Product
BLEDIS_MANUFACTURER, // 1: Manufacturer
BLEDIS_MODEL, // 2: Product
desc_str_serial, // 3: Serials, should use chip ID
"Bluefruit Serial", // 4: CDC Interface
"Bluefruit UF2", // 5: MSC Interface
"nRF Serial", // 4: CDC Interface
"nRF UF2", // 5: MSC Interface
};
// up to 32 unicode characters (header make it 33)
static uint16_t _desc_str[33];
// up to 64 unicode characters
static uint16_t _desc_str[64+1];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete

View File

@ -31,15 +31,15 @@
void usb_desc_init(bool cdc_only);
#ifndef USB_DESC_VID
#define USB_DESC_VID 0x239A
#define USB_DESC_VID 0x239A
#endif
#ifndef USB_DESC_UF2_PID
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_UF2_PID 0x0029
#endif
#ifndef USB_DESC_CDC_ONLY_PID
#define USB_DESC_CDC_ONLY_PID 0x002A
#define USB_DESC_CDC_ONLY_PID 0x002A
#endif
#endif /* USB_DESC_H_ */