improving midi support, adding midi exmaple

rename TUSB_DESC_CLASS_SPECIFIC to TUSB_DESC_CS_INTERFACE
This commit is contained in:
hathach
2019-07-01 22:38:06 +07:00
parent 991aaf0158
commit 6991b28532
15 changed files with 596 additions and 51 deletions

View File

@@ -32,7 +32,7 @@
* [MSB] HID | MSC | CDC [LSB]
*/
#define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) )
#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) )
#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | _PID_MAP(MIDI, 3) )
//------------- Device Descriptors -------------//
tusb_desc_device_t const desc_device =
@@ -81,7 +81,7 @@ enum
uint8_t const desc_configuration[] =
{
// Inteface count, string index, total length, attribute, power in mA
// interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
@@ -138,6 +138,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index)
chr_count = 1;
}else
{
// Convert ASCII string into UTF-16
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
const char* str = string_desc_arr[index];