Skip to content

Commit f2168e4

Browse files
committed
define Serial as SerialTinyUSB if USE_TINYUSB is defined
1 parent 69333be commit f2168e4

9 files changed

+13
-9
lines changed

examples/CDC/cdc_multi/.feather_esp32s2.test.skip

Whitespace-only changes.

examples/CDC/cdc_multi/.feather_esp32s3.test.skip

Whitespace-only changes.

examples/CDC/cdc_multi/.funhouse.test.skip

Whitespace-only changes.

examples/CDC/cdc_multi/.magtag.test.skip

Whitespace-only changes.

examples/CDC/cdc_multi/.metroesp32s2.test.skip

Whitespace-only changes.

examples/CDC/cdc_multi/.pico_rp2040_tinyusb_host.test.skip

Whitespace-only changes.

examples/CDC/cdc_multi/.skip.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
feather_esp32s2
2+
feather_esp32s3
3+
funhouse
4+
magtag
5+
metroesp32s2
6+
pico_rp2040_tinyusb_host

src/arduino/Adafruit_USBD_CDC.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,11 @@ class Adafruit_USBD_CDC : public Stream, public Adafruit_USBD_Interface {
9393
bool isValid(void) { return _instance != INVALID_INSTANCE; }
9494
};
9595

96-
// "Serial" is used with TinyUSB CDC
97-
#if defined(USE_TINYUSB)
98-
extern Adafruit_USBD_CDC Serial;
99-
#define SerialTinyUSB Serial
100-
#endif
101-
102-
// Serial is probably used with HW Uart
103-
#ifndef SerialTinyUSB
10496
extern Adafruit_USBD_CDC SerialTinyUSB;
97+
98+
// Built-in support "Serial" is used with TinyUSB CDC
99+
#if defined(USE_TINYUSB)
100+
#define Serial SerialTinyUSB
105101
#endif
106102

107103
#endif // else of ESP32

src/arduino/ports/ch32/Adafruit_TinyUSB_ch32.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ USBWakeUp_IRQHandler(void) {
7676

7777
void yield(void) {
7878
tud_task();
79-
// flush cdc
79+
if (tud_cdc_connected()) {
80+
tud_cdc_write_flush();
81+
}
8082
}
8183
}
8284

0 commit comments

Comments
 (0)