Skip to content

Commit b1a7975

Browse files
authored
Merge pull request arduino#192 from hathach/develop
update tinyusb
2 parents 1941e17 + 861fec5 commit b1a7975

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

cores/arduino/TinyUSB/Adafruit_TinyUSB_SAMD.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,29 @@
3333
//--------------------------------------------------------------------+
3434
static void usb_hardware_init(void);
3535

36+
#if CFG_TUSB_DEBUG
37+
extern "C" int serial1_printf(const char *__restrict format, ...)
38+
{
39+
char buf[PRINTF_BUF];
40+
va_list ap;
41+
va_start(ap, format);
42+
vsnprintf(buf, sizeof(buf), format, ap);
43+
Serial1.write(buf);
44+
va_end(ap);
45+
46+
}
47+
#endif
48+
3649
//--------------------------------------------------------------------+
3750
// Core Init & Touch1200
3851
//--------------------------------------------------------------------+
3952
void Adafruit_TinyUSB_Core_init(void)
4053
{
54+
#if CFG_TUSB_DEBUG
55+
Serial1.begin(115200);
56+
serial1_printf("TinyUSB debugging with Serial1\n");
57+
#endif
58+
4159
USBDevice.addInterface( (Adafruit_USBD_Interface&) Serial);
4260
USBDevice.setID(USB_VID, USB_PID);
4361
USBDevice.begin();

cores/arduino/TinyUSB/tusb_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646

4747
#define CFG_TUSB_OS OPT_OS_NONE
4848

49+
#define CFG_TUSB_DEBUG 0
50+
#if CFG_TUSB_DEBUG
51+
#define tu_printf serial1_printf
52+
extern int serial1_printf(const char *__restrict __format, ...);
53+
#endif
54+
4955
#define CFG_TUSB_MEM_SECTION
5056
#define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)
5157

0 commit comments

Comments
 (0)