|
@@ -19,6 +19,7 @@
|
19
|
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
20
|
*
|
21
|
21
|
*/
|
|
22
|
+#pragma once
|
22
|
23
|
|
23
|
24
|
/**
|
24
|
25
|
* MarlinSerial_Due.h - Hardware serial library for Arduino DUE
|
|
@@ -26,9 +27,6 @@
|
26
|
27
|
* Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
27
|
28
|
*/
|
28
|
29
|
|
29
|
|
-#ifndef MARLINSERIAL_DUE_H
|
30
|
|
-#define MARLINSERIAL_DUE_H
|
31
|
|
-
|
32
|
30
|
#include "../shared/MarlinSerial.h"
|
33
|
31
|
|
34
|
32
|
#include <WString.h>
|
|
@@ -159,42 +157,29 @@ private:
|
159
|
157
|
static void printFloat(double, uint8_t);
|
160
|
158
|
};
|
161
|
159
|
|
|
160
|
+// Serial port configuration
|
|
161
|
+template <uint8_t serial>
|
|
162
|
+struct MarlinSerialCfg {
|
|
163
|
+ static constexpr int PORT = serial;
|
|
164
|
+ static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE;
|
|
165
|
+ static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE;
|
|
166
|
+ static constexpr bool XONOFF = bSERIAL_XON_XOFF;
|
|
167
|
+ static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER;
|
|
168
|
+ static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX;
|
|
169
|
+ static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS;
|
|
170
|
+ static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS;
|
|
171
|
+ static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED;
|
|
172
|
+};
|
|
173
|
+
|
162
|
174
|
#if SERIAL_PORT >= 0
|
163
|
175
|
|
164
|
|
- // Serial port configuration
|
165
|
|
- struct MarlinSerialCfg1 {
|
166
|
|
- static constexpr int PORT = SERIAL_PORT;
|
167
|
|
- static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE;
|
168
|
|
- static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE;
|
169
|
|
- static constexpr bool XONOFF = bSERIAL_XON_XOFF;
|
170
|
|
- static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER;
|
171
|
|
- static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX;
|
172
|
|
- static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS;
|
173
|
|
- static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS;
|
174
|
|
- static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED;
|
175
|
|
- };
|
176
|
|
-
|
177
|
|
- extern MarlinSerial<MarlinSerialCfg1> customizedSerial1;
|
178
|
|
-
|
|
176
|
+ extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
|
|
177
|
+
|
179
|
178
|
#endif // SERIAL_PORT >= 0
|
180
|
179
|
|
181
|
180
|
#ifdef SERIAL_PORT_2
|
182
|
181
|
|
183
|
|
- // Serial port configuration
|
184
|
|
- struct MarlinSerialCfg2 {
|
185
|
|
- static constexpr int PORT = SERIAL_PORT_2;
|
186
|
|
- static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE;
|
187
|
|
- static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE;
|
188
|
|
- static constexpr bool XONOFF = bSERIAL_XON_XOFF;
|
189
|
|
- static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER;
|
190
|
|
- static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX;
|
191
|
|
- static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS;
|
192
|
|
- static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS;
|
193
|
|
- static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED;
|
194
|
|
- };
|
195
|
|
-
|
196
|
|
- extern MarlinSerial<MarlinSerialCfg2> customizedSerial2;
|
197
|
|
-
|
|
182
|
+ extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
|
|
183
|
+
|
198
|
184
|
#endif
|
199
|
185
|
|
200
|
|
-#endif // MARLINSERIAL_DUE_H
|