Skip to content

Commit

Permalink
define Serial as SerialTinyUSB if USE_TINYUSB is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Jun 13, 2024
1 parent 69333be commit f2168e4
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 9 deletions.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions examples/CDC/cdc_multi/.skip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
feather_esp32s2
feather_esp32s3
funhouse
magtag
metroesp32s2
pico_rp2040_tinyusb_host
12 changes: 4 additions & 8 deletions src/arduino/Adafruit_USBD_CDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,11 @@ class Adafruit_USBD_CDC : public Stream, public Adafruit_USBD_Interface {
bool isValid(void) { return _instance != INVALID_INSTANCE; }
};

// "Serial" is used with TinyUSB CDC
#if defined(USE_TINYUSB)
extern Adafruit_USBD_CDC Serial;
#define SerialTinyUSB Serial
#endif

// Serial is probably used with HW Uart
#ifndef SerialTinyUSB
extern Adafruit_USBD_CDC SerialTinyUSB;

// Built-in support "Serial" is used with TinyUSB CDC
#if defined(USE_TINYUSB)
#define Serial SerialTinyUSB
#endif

#endif // else of ESP32
Expand Down
4 changes: 3 additions & 1 deletion src/arduino/ports/ch32/Adafruit_TinyUSB_ch32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ USBWakeUp_IRQHandler(void) {

void yield(void) {
tud_task();
// flush cdc
if (tud_cdc_connected()) {
tud_cdc_write_flush();
}
}
}

Expand Down

0 comments on commit f2168e4

Please sign in to comment.