Skip to content

Commit f5ad52f

Browse files
committed
more update for ch32
1 parent d1708bc commit f5ad52f

File tree

6 files changed

+6
-5
lines changed

6 files changed

+6
-5
lines changed

examples/CDC/serial_echo/serial_echo.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
/* This sketch demonstrates USB CDC Serial echo (convert to upper case) using SerialTinyUSB which
1515
* is available for both core with built-in USB support and without.
16+
* Note: on core with built-in support Serial is alias to SerialTinyUSB
1617
*/
1718

1819
void setup() {

src/arduino/Adafruit_TinyUSB_API.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#define TINYUSB_API_VERSION 30000
3434

3535
#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_NRF52_ADAFRUIT) || \
36-
defined(ARDUINO_ARCH_ESP32) || \
36+
defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_CH32) || \
3737
(defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED))
3838
#define TINYUSB_HAS_BUITLTIN_CORE_SUPPORT
3939
#endif

src/arduino/Adafruit_USBD_CDC.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ class Adafruit_USBD_CDC : public Stream, public Adafruit_USBD_Interface {
9696
extern Adafruit_USBD_CDC SerialTinyUSB;
9797

9898
// Built-in support "Serial" is assigned to TinyUSB CDC
99-
#if defined(USE_TINYUSB)
99+
// CH32 defines Serial as alias in WSerial.h
100+
#if defined(USE_TINYUSB) && !defined(ARDUINO_ARCH_CH32)
100101
#define SerialTinyUSB Serial
101102
#endif
102103

src/arduino/Adafruit_USBD_Interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <stddef.h>
2929
#include <stdint.h>
3030

31-
#if defined(CH32V20x) || defined(CH32V30x)
31+
#if defined(ARDUINO_ARCH_CH32) || defined(CH32V20x) || defined(CH32V30x)
3232
// HACK: required for ch32 core version 1.0.4 or prior, removed when 1.0.5 is
3333
// released
3434
extern "C" void yield(void);

src/arduino/ports/ch32/tusb_config_ch32.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ extern "C" {
3434
//--------------------------------------------------------------------
3535
#if defined(CH32V20x)
3636
#define CFG_TUSB_MCU OPT_MCU_CH32V20X
37-
#define CFG_TUD_WCH_USBIP_FSDEV 1 // use USBD
3837
#elif defined(CH32V30x)
3938
#define CFG_TUSB_MCU OPT_MCU_CH32V307
4039
#endif

src/tusb_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
// Note: For platformio prioritize this file over the one in BSP in all cases
5353

54-
#elif defined(CH32V20x) || defined(CH32V30x) // using build.series
54+
#elif defined(ARDUINO_ARCH_CH32) || defined(CH32V20x) || defined(CH32V30x)
5555
#include "arduino/ports/ch32/tusb_config_ch32.h"
5656
#else
5757
#error TinyUSB Arduino Library does not support your core yet

0 commit comments

Comments
 (0)