File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ extern __IO uint32_t UserRxBufPtrIn;
3737extern __IO uint32_t UserRxBufPtrOut;
3838
3939USBSerial SerialUSB;
40+ void serialEventUSB () __attribute__((weak));
4041
4142void USBSerial::begin (uint32_t /* baud_count */ ) {
4243 // uart config is ignored in USB-CDC
Original file line number Diff line number Diff line change @@ -35,5 +35,8 @@ void serialEventRun(void)
3535#if defined(HAVE_HWSERIALLP1)
3636 if (serialEventLP1 && SerialLP1.available ()) serialEventLP1 ();
3737#endif
38+ #if defined(HAVE_SERIALUSB)
39+ if (serialEventUSB && SerialUSB.available ()) serialEventUSB ();
40+ #endif
3841}
3942
Original file line number Diff line number Diff line change 33
44#include "variant.h"
55#include "HardwareSerial.h"
6+ #include "USBSerial.h"
67
7- #if defined(HAL_UART_MODULE_ENABLED )
8+ #if defined (USBCON ) && defined(USBD_USE_CDC )
9+ #ifndef DISABLE_GENERIC_SERIALUSB
10+ #define ENABLE_SERIALUSB
11+ #if !defined(Serial )
12+ #define Serial SerialUSB
13+ #define serialEvent serialEventUSB
14+ #endif
15+ #endif
16+
17+ #if defined(ENABLE_SERIALUSB )
18+ #define HAVE_SERIALUSB
19+ #endif
20+
21+ extern void serialEventUSB (void ) __attribute__((weak ));
22+ #endif /* USBCON && USBD_USE_CDC */
823
24+ #if defined(HAL_UART_MODULE_ENABLED )
925#if !defined(HWSERIAL_NONE ) && defined(SERIAL_UART_INSTANCE )
1026#if SERIAL_UART_INSTANCE == 0
1127#define ENABLE_HWSERIALLP1
@@ -147,8 +163,8 @@ extern void serialEvent8(void) __attribute__((weak));
147163extern void serialEvent9 (void ) __attribute__((weak ));
148164extern void serialEvent10 (void ) __attribute__((weak ));
149165extern void serialEventLP1 (void ) __attribute__((weak ));
150-
151166#endif /* HAL_UART_MODULE_ENABLED */
167+
152168extern void serialEventRun (void ) __attribute__((weak ));
153169
154- #endif // WIRING_SERIAL_H
170+ #endif /* WIRING_SERIAL_H */
Original file line number Diff line number Diff line change 4242
4343#ifdef __cplusplus
4444#include "Tone.h"
45- #include "USBSerial.h"
4645#include "WCharacter.h"
4746#include "WSerial.h"
4847#include "WMath.h"
You can’t perform that action at this time.
0 commit comments