|
@@ -51,57 +51,67 @@
|
51
|
51
|
#include <USBSerial.h>
|
52
|
52
|
#include "../../core/serial_hook.h"
|
53
|
53
|
typedef ForwardSerial1Class< decltype(SerialUSB) > DefaultSerial1;
|
54
|
|
- extern DefaultSerial1 MSerial0;
|
|
54
|
+ extern DefaultSerial1 MSerialUSB;
|
55
|
55
|
#endif
|
56
|
56
|
|
57
|
57
|
#define _MSERIAL(X) MSerial##X
|
58
|
58
|
#define MSERIAL(X) _MSERIAL(X)
|
59
|
59
|
|
60
|
|
-#if SERIAL_PORT == -1
|
61
|
|
- #define MYSERIAL1 MSerial0
|
62
|
|
-#elif WITHIN(SERIAL_PORT, 1, 6)
|
|
60
|
+#if WITHIN(SERIAL_PORT, 1, 6)
|
63
|
61
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
|
|
62
|
+#elif !defined(USBCON)
|
|
63
|
+ #error "SERIAL_PORT must be from 1 to 6."
|
|
64
|
+#elif SERIAL_PORT == -1
|
|
65
|
+ #define MYSERIAL1 MSerialUSB
|
64
|
66
|
#else
|
65
|
|
- #error "SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
67
|
+ #error "SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
66
|
68
|
#endif
|
67
|
69
|
|
68
|
70
|
#ifdef SERIAL_PORT_2
|
69
|
|
- #if SERIAL_PORT_2 == -1
|
70
|
|
- #define MYSERIAL2 MSerial0
|
71
|
|
- #elif WITHIN(SERIAL_PORT_2, 1, 6)
|
|
71
|
+ #if WITHIN(SERIAL_PORT_2, 1, 6)
|
72
|
72
|
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
|
|
73
|
+ #elif !defined(USBCON)
|
|
74
|
+ #error "SERIAL_PORT must be from 1 to 6."
|
|
75
|
+ #elif SERIAL_PORT_2 == -1
|
|
76
|
+ #define MYSERIAL2 MSerialUSB
|
73
|
77
|
#else
|
74
|
|
- #error "SERIAL_PORT_2 must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
78
|
+ #error "SERIAL_PORT_2 must be from 1 to 6, or -1 for Native USB."
|
75
|
79
|
#endif
|
76
|
80
|
#endif
|
77
|
81
|
|
78
|
82
|
#ifdef SERIAL_PORT_3
|
79
|
|
- #if SERIAL_PORT_3 == -1
|
80
|
|
- #define MYSERIAL3 MSerial0
|
81
|
|
- #elif WITHIN(SERIAL_PORT_3, 1, 6)
|
|
83
|
+ #if WITHIN(SERIAL_PORT_3, 1, 6)
|
82
|
84
|
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
|
|
85
|
+ #elif !defined(USBCON)
|
|
86
|
+ #error "SERIAL_PORT must be from 1 to 6."
|
|
87
|
+ #elif SERIAL_PORT_3 == -1
|
|
88
|
+ #define MYSERIAL3 MSerialUSB
|
83
|
89
|
#else
|
84
|
|
- #error "SERIAL_PORT_3 must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
90
|
+ #error "SERIAL_PORT_3 must be from 1 to 6, or -1 for Native USB."
|
85
|
91
|
#endif
|
86
|
92
|
#endif
|
87
|
93
|
|
88
|
94
|
#ifdef MMU2_SERIAL_PORT
|
89
|
|
- #if MMU2_SERIAL_PORT == -1
|
90
|
|
- #define MMU2_SERIAL MSerial0
|
91
|
|
- #elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
|
|
95
|
+ #if WITHIN(MMU2_SERIAL_PORT, 1, 6)
|
92
|
96
|
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
|
|
97
|
+ #elif !defined(USBCON)
|
|
98
|
+ #error "SERIAL_PORT must be from 1 to 6."
|
|
99
|
+ #elif MMU2_SERIAL_PORT == -1
|
|
100
|
+ #define MMU2_SERIAL MSerialUSB
|
93
|
101
|
#else
|
94
|
|
- #error "MMU2_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
102
|
+ #error "MMU2_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
95
|
103
|
#endif
|
96
|
104
|
#endif
|
97
|
105
|
|
98
|
106
|
#ifdef LCD_SERIAL_PORT
|
99
|
|
- #if LCD_SERIAL_PORT == -1
|
100
|
|
- #define LCD_SERIAL MSerial0
|
101
|
|
- #elif WITHIN(LCD_SERIAL_PORT, 1, 6)
|
|
107
|
+ #if WITHIN(LCD_SERIAL_PORT, 1, 6)
|
102
|
108
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
|
109
|
+ #elif !defined(USBCON)
|
|
110
|
+ #error "SERIAL_PORT must be from 1 to 6."
|
|
111
|
+ #elif LCD_SERIAL_PORT == -1
|
|
112
|
+ #define LCD_SERIAL MSerialUSB
|
103
|
113
|
#else
|
104
|
|
- #error "LCD_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
114
|
+ #error "LCD_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
105
|
115
|
#endif
|
106
|
116
|
#if HAS_DGUS_LCD
|
107
|
117
|
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|