diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fc11f3dd..729222512 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,8 @@ jobs: strategy: fail-fast: false matrix: - example: ['board_test', 'cdc_msc', 'dfu_rt', 'hid_composite', 'hid_generic_inout', 'midi_test', 'msc_dual_lun', 'usbtmc', 'webusb_serial'] + example: ['board_test', 'cdc_dual_ports', 'cdc_msc', 'dfu_rt', 'hid_composite', + 'hid_generic_inout', 'midi_test', 'msc_dual_lun', 'usbtmc', 'webusb_serial'] steps: - name: Setup Python uses: actions/setup-python@v1 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0b52c4c5b..e1d5db693 100644 --- a/CONTRIBUTORS.md +++ b/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 diff --git a/examples/device/cdc_dual_ports/src/main.c b/examples/device/cdc_dual_ports/src/main.c index e612dc83a..d6e38df85 100644 --- a/examples/device/cdc_dual_ports/src/main.c +++ b/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); @@ -51,7 +50,9 @@ int main(void) return 0; } -static void echo_all(uint8_t itf, uint8_t buf[], uint32_t count) +// echo to either Serial0 or Serial1 +// with Serial0 as all lower case, Serial1 as all upper case +static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count) { for(uint32_t i=0; i 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 diff --git a/examples/device/cdc_dual_ports/src/usb_descriptors.h b/examples/device/cdc_dual_ports/src/usb_descriptors.h deleted file mode 100644 index 280570831..000000000 --- a/examples/device/cdc_dual_ports/src/usb_descriptors.h +++ /dev/null @@ -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_ */