Skip to content

Commit 321e8fb

Browse files
authored
Adding safeguard for USBSerial
ref: espressif/arduino-esp32#8276 (comment)
1 parent 3fb2a2c commit 321e8fb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/M5CoreS3.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#ifndef _M5CORES3_H_
22
#define _M5CORES3_H_
33

4+
#if ARDUINO_USB_CDC_ON_BOOT
5+
#define USBSerial Serial
6+
#else
7+
#include <HWCDC.h>
8+
// the warning produced by using the 'inline' keyword is a necessary evil as (HWCDC)USBSerial is declared extern and can't be casted as static
9+
inline HWCDC USBSerial;
10+
#endif
11+
412
#include <Arduino.h>
513
#include <Wire.h>
614
#include "FS.h"
@@ -40,4 +48,4 @@ extern M5CoreS3 M5;
4048
#define imu IMU
4149
#define Imu IMU
4250

43-
#endif
51+
#endif

0 commit comments

Comments
 (0)