From 32e27353503dc41b4870761ada90bd7b752ade6d Mon Sep 17 00:00:00 2001 From: mrceki <105711013+mrceki@users.noreply.github.com> Date: Tue, 12 Sep 2023 13:57:40 +0300 Subject: [PATCH] Adding support for microcontrollers that do not have a dedicated USB-to-UART chip, such as the ESP32-S2, ESP32-S3, and ESP32-C3. --- rosserial_arduino/src/ros_lib/ArduinoHardware.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rosserial_arduino/src/ros_lib/ArduinoHardware.h b/rosserial_arduino/src/ros_lib/ArduinoHardware.h index 08fbbd5e6..2450a83d3 100644 --- a/rosserial_arduino/src/ros_lib/ArduinoHardware.h +++ b/rosserial_arduino/src/ros_lib/ArduinoHardware.h @@ -59,7 +59,15 @@ #define SERIAL_CLASS USBSerial #else #include // Arduino AVR - #define SERIAL_CLASS HardwareSerial + #if defined(USE_USBCDC) + // ESP32-S2 ESP32-C3 + #define SERIAL_CLASS USBCDC + #elif defined(USE_HWCDC) + // ESP32-S3 + #define SERIAL_CLASS HWCDC + #else + #define SERIAL_CLASS HardwareSerial + #endif #endif class ArduinoHardware {