mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-20 22:20:55 +00:00
commit
13016c5cbb
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<count; i++)
|
||||
{
|
||||
@ -65,7 +66,7 @@ static void echo_all(uint8_t itf, uint8_t buf[], uint32_t count)
|
||||
// echo back additional ports as upper case
|
||||
if (islower(buf[i])) buf[i] -= 'a' - 'A';
|
||||
}
|
||||
|
||||
|
||||
tud_cdc_n_write_char(itf, buf[i]);
|
||||
|
||||
if ( buf[i] == '\r' ) tud_cdc_n_write_char(itf, '\n');
|
||||
@ -90,8 +91,9 @@ static void cdc_task(void)
|
||||
|
||||
uint32_t count = tud_cdc_n_read(itf, buf, sizeof(buf));
|
||||
|
||||
// echo back to cdc
|
||||
echo_all(itf, buf, count);
|
||||
// echo back to both serial ports
|
||||
echo_serial_port(0, buf, count);
|
||||
echo_serial_port(1, buf, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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_ */
|
Loading…
x
Reference in New Issue
Block a user