File tree 4 files changed +23
-4
lines changed
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;
37
37
extern __IO uint32_t UserRxBufPtrOut;
38
38
39
39
USBSerial SerialUSB;
40
+ void serialEventUSB () __attribute__((weak));
40
41
41
42
void USBSerial::begin (uint32_t /* baud_count */ ) {
42
43
// uart config is ignored in USB-CDC
Original file line number Diff line number Diff line change @@ -35,5 +35,8 @@ void serialEventRun(void)
35
35
#if defined(HAVE_HWSERIALLP1)
36
36
if (serialEventLP1 && SerialLP1.available ()) serialEventLP1 ();
37
37
#endif
38
+ #if defined(HAVE_SERIALUSB)
39
+ if (serialEventUSB && SerialUSB.available ()) serialEventUSB ();
40
+ #endif
38
41
}
39
42
Original file line number Diff line number Diff line change 3
3
4
4
#include "variant.h"
5
5
#include "HardwareSerial.h"
6
+ #include "USBSerial.h"
6
7
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 */
8
23
24
+ #if defined(HAL_UART_MODULE_ENABLED )
9
25
#if !defined(HWSERIAL_NONE ) && defined(SERIAL_UART_INSTANCE )
10
26
#if SERIAL_UART_INSTANCE == 0
11
27
#define ENABLE_HWSERIALLP1
@@ -147,8 +163,8 @@ extern void serialEvent8(void) __attribute__((weak));
147
163
extern void serialEvent9 (void ) __attribute__((weak ));
148
164
extern void serialEvent10 (void ) __attribute__((weak ));
149
165
extern void serialEventLP1 (void ) __attribute__((weak ));
150
-
151
166
#endif /* HAL_UART_MODULE_ENABLED */
167
+
152
168
extern void serialEventRun (void ) __attribute__((weak ));
153
169
154
- #endif // WIRING_SERIAL_H
170
+ #endif /* WIRING_SERIAL_H */
Original file line number Diff line number Diff line change 42
42
43
43
#ifdef __cplusplus
44
44
#include "Tone.h"
45
- #include "USBSerial.h"
46
45
#include "WCharacter.h"
47
46
#include "WSerial.h"
48
47
#include "WMath.h"
You can’t perform that action at this time.
0 commit comments