24
24
#endif
25
25
26
26
void serialEvent (void ) __attribute__((weak));
27
- void serialEvent (void ) {}
28
27
29
28
#if SOC_UART_NUM > 1
30
29
void serialEvent1 (void ) __attribute__((weak));
31
- void serialEvent1 (void ) {}
32
30
#endif /* SOC_UART_NUM > 1 */
33
31
34
32
#if SOC_UART_NUM > 2
35
33
void serialEvent2 (void ) __attribute__((weak));
36
- void serialEvent2 (void ) {}
37
34
#endif /* SOC_UART_NUM > 2 */
38
35
39
36
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
@@ -48,37 +45,35 @@ HardwareSerial Serial2(2);
48
45
49
46
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
50
47
extern void HWCDCSerialEvent (void ) __attribute__((weak));
51
- void HWCDCSerialEvent (void ) {}
52
48
#endif
53
49
54
50
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
55
51
// Used by Hardware Serial for USB CDC events
56
52
extern void USBSerialEvent (void ) __attribute__((weak));
57
- void USBSerialEvent (void ) {}
58
53
#endif
59
54
60
55
void serialEventRun (void ) {
61
56
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
62
- if (HWCDCSerial.available ()) {
57
+ if (HWCDCSerialEvent && HWCDCSerial.available ()) {
63
58
HWCDCSerialEvent ();
64
59
}
65
60
#endif
66
61
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
67
- if (USBSerial.available ()) {
62
+ if (USBSerialEvent && USBSerial.available ()) {
68
63
USBSerialEvent ();
69
64
}
70
65
#endif
71
66
// UART0 is default serialEvent()
72
- if (Serial0.available ()) {
67
+ if (serialEvent && Serial0.available ()) {
73
68
serialEvent ();
74
69
}
75
70
#if SOC_UART_NUM > 1
76
- if (Serial1.available ()) {
71
+ if (serialEvent1 && Serial1.available ()) {
77
72
serialEvent1 ();
78
73
}
79
74
#endif
80
75
#if SOC_UART_NUM > 2
81
- if (Serial2.available ()) {
76
+ if (serialEvent2 && Serial2.available ()) {
82
77
serialEvent2 ();
83
78
}
84
79
#endif
0 commit comments