hathach 6 лет назад
Родитель
Сommit
242a2b6126

+ 1 - 0
CONTRIBUTORS.md

@@ -27,6 +27,7 @@
 * **[Peter Lawrence](https://github.com/majbthrd)**
   * Nuvoton NUC 121, 125, 126 device driver port
   * Board support for NuTiny NUC121s, NUC125s, NUC126V
+  * Complete multiple class interfaces & add cdc_dual_ports example 
   
 * **[Scott Shawcroft](https://github.com/tannewt)**
   * SAMD21 and SAMD51 device driver port

+ 0 - 1
examples/device/cdc_dual_ports/src/main.c

@@ -30,7 +30,6 @@
 
 #include "bsp/board.h"
 #include "tusb.h"
-#include "usb_descriptors.h"
 
 //------------- prototypes -------------//
 static void cdc_task(void);

+ 3 - 6
examples/device/cdc_dual_ports/src/usb_descriptors.c

@@ -24,7 +24,6 @@
  */
 
 #include "tusb.h"
-#include "usb_descriptors.h"
 
 /* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
  * Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
@@ -77,10 +76,8 @@ enum
 {
   ITF_NUM_CDC1 = 0,
   ITF_NUM_CDC_DATA1,
-#if (CFG_TUD_CDC > 1)
   ITF_NUM_CDC2,
   ITF_NUM_CDC_DATA2,
-#endif
   ITF_NUM_TOTAL
 };
 
@@ -99,11 +96,11 @@ uint8_t const desc_configuration[] =
   // 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, EP notification address and size, EP data address (out, in) and size.
+  // 1st CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size.
   TUD_CDC_DESCRIPTOR(ITF_NUM_CDC1, 4, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, 64),
-#if (CFG_TUD_CDC > 1)
+
+  // 2nd CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size.
   TUD_CDC_DESCRIPTOR(ITF_NUM_CDC2, 4, 0x83, 8, EPNUM_CDC + 2, 0x80 | (EPNUM_CDC + 2), 64),
-#endif
 };
 
 // Invoked when received GET CONFIGURATION DESCRIPTOR

+ 0 - 28
examples/device/cdc_dual_ports/src/usb_descriptors.h

@@ -1,28 +0,0 @@
-/* 
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Ha Thach (tinyusb.org)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef USB_DESCRIPTORS_H_
-#define USB_DESCRIPTORS_H_
-
-#endif /* USB_DESCRIPTORS_H_ */