Skip to content

Commit c4aebf3

Browse files
committed
tinyusb clean up
1 parent b88912c commit c4aebf3

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

cores/arduino/Adafruit_TinyUSB_Core/Adafruit_USBD_Device.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index)
198198
default: return NULL;
199199
}
200200

201-
// first byte is len, second byte is string type
202-
_desc_str[0] = TUD_DESC_STR_HEADER(chr_count);
201+
// first byte is length (including header), second byte is string type
202+
_desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
203203

204204
return _desc_str;
205205
}

cores/arduino/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_types.h

-9
Original file line numberDiff line numberDiff line change
@@ -469,15 +469,6 @@ static inline uint8_t tu_desc_len(void const* desc)
469469
return ((uint8_t const*) desc)[DESC_OFFSET_LEN];
470470
}
471471

472-
// Length of the string descriptors in bytes with slen characters
473-
#define TUD_DESC_STRLEN(_chr_count) (2*(_chr_count) + 2)
474-
475-
// Header of string descriptors with len + string type
476-
#define TUD_DESC_STR_HEADER(_chr_count) ( (uint16_t) ( (TUSB_DESC_STRING << 8 ) | TUD_DESC_STRLEN(_chr_count)) )
477-
478-
// Convert comma-separated string to descriptor unicode format
479-
#define TUD_DESC_STRCONV( ... ) (const uint16_t[]) { TUD_DESC_STR_HEADER(TU_ARGS_NUM(__VA_ARGS__)), __VA_ARGS__ }
480-
481472
#ifdef __cplusplus
482473
}
483474
#endif

cores/arduino/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.h

-5
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,6 @@ TU_ATTR_WEAK bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_re
143143
0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C, \
144144
0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F
145145

146-
//------------- WebUSB URL -------------//
147-
// used to init tusb_desc_webusb_url_t
148-
#define TUD_WEBUSB_URL_DESCRIPTOR(_scheme, _url) \
149-
{ 3 + sizeof(_url) - 1, 3, _scheme, _url }
150-
151146
//--------------------------------------------------------------------+
152147
// Configuration & Interface Descriptor Templates
153148
//--------------------------------------------------------------------+

0 commit comments

Comments
 (0)