Skip to content

Commit

Permalink
more update for ch32
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Jun 13, 2024
1 parent d1708bc commit f5ad52f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/CDC/serial_echo/serial_echo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

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

void setup() {
Expand Down
2 changes: 1 addition & 1 deletion src/arduino/Adafruit_TinyUSB_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define TINYUSB_API_VERSION 30000

#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(ARDUINO_ARCH_ESP32) || \
defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_CH32) || \
(defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED))
#define TINYUSB_HAS_BUITLTIN_CORE_SUPPORT
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/arduino/Adafruit_USBD_CDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ class Adafruit_USBD_CDC : public Stream, public Adafruit_USBD_Interface {
extern Adafruit_USBD_CDC SerialTinyUSB;

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

Expand Down
2 changes: 1 addition & 1 deletion src/arduino/Adafruit_USBD_Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <stddef.h>
#include <stdint.h>

#if defined(CH32V20x) || defined(CH32V30x)
#if defined(ARDUINO_ARCH_CH32) || defined(CH32V20x) || defined(CH32V30x)
// HACK: required for ch32 core version 1.0.4 or prior, removed when 1.0.5 is
// released
extern "C" void yield(void);
Expand Down
1 change: 0 additions & 1 deletion src/arduino/ports/ch32/tusb_config_ch32.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ extern "C" {
//--------------------------------------------------------------------
#if defined(CH32V20x)
#define CFG_TUSB_MCU OPT_MCU_CH32V20X
#define CFG_TUD_WCH_USBIP_FSDEV 1 // use USBD
#elif defined(CH32V30x)
#define CFG_TUSB_MCU OPT_MCU_CH32V307
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

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

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

0 comments on commit f5ad52f

Please sign in to comment.