|
|
|
@ -51,57 +51,67 @@
|
|
|
|
|
#include <USBSerial.h>
|
|
|
|
|
#include "../../core/serial_hook.h"
|
|
|
|
|
typedef ForwardSerial1Class< decltype(SerialUSB) > DefaultSerial1;
|
|
|
|
|
extern DefaultSerial1 MSerial0;
|
|
|
|
|
extern DefaultSerial1 MSerialUSB;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define _MSERIAL(X) MSerial##X
|
|
|
|
|
#define MSERIAL(X) _MSERIAL(X)
|
|
|
|
|
|
|
|
|
|
#if SERIAL_PORT == -1
|
|
|
|
|
#define MYSERIAL1 MSerial0
|
|
|
|
|
#elif WITHIN(SERIAL_PORT, 1, 6)
|
|
|
|
|
#if WITHIN(SERIAL_PORT, 1, 6)
|
|
|
|
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
|
|
|
|
|
#elif !defined(USBCON)
|
|
|
|
|
#error "SERIAL_PORT must be from 1 to 6."
|
|
|
|
|
#elif SERIAL_PORT == -1
|
|
|
|
|
#define MYSERIAL1 MSerialUSB
|
|
|
|
|
#else
|
|
|
|
|
#error "SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
|
|
|
#error "SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef SERIAL_PORT_2
|
|
|
|
|
#if SERIAL_PORT_2 == -1
|
|
|
|
|
#define MYSERIAL2 MSerial0
|
|
|
|
|
#elif WITHIN(SERIAL_PORT_2, 1, 6)
|
|
|
|
|
#if WITHIN(SERIAL_PORT_2, 1, 6)
|
|
|
|
|
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
|
|
|
|
|
#elif !defined(USBCON)
|
|
|
|
|
#error "SERIAL_PORT must be from 1 to 6."
|
|
|
|
|
#elif SERIAL_PORT_2 == -1
|
|
|
|
|
#define MYSERIAL2 MSerialUSB
|
|
|
|
|
#else
|
|
|
|
|
#error "SERIAL_PORT_2 must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
|
|
|
#error "SERIAL_PORT_2 must be from 1 to 6, or -1 for Native USB."
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef SERIAL_PORT_3
|
|
|
|
|
#if SERIAL_PORT_3 == -1
|
|
|
|
|
#define MYSERIAL3 MSerial0
|
|
|
|
|
#elif WITHIN(SERIAL_PORT_3, 1, 6)
|
|
|
|
|
#if WITHIN(SERIAL_PORT_3, 1, 6)
|
|
|
|
|
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
|
|
|
|
|
#elif !defined(USBCON)
|
|
|
|
|
#error "SERIAL_PORT must be from 1 to 6."
|
|
|
|
|
#elif SERIAL_PORT_3 == -1
|
|
|
|
|
#define MYSERIAL3 MSerialUSB
|
|
|
|
|
#else
|
|
|
|
|
#error "SERIAL_PORT_3 must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
|
|
|
#error "SERIAL_PORT_3 must be from 1 to 6, or -1 for Native USB."
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef MMU2_SERIAL_PORT
|
|
|
|
|
#if MMU2_SERIAL_PORT == -1
|
|
|
|
|
#define MMU2_SERIAL MSerial0
|
|
|
|
|
#elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
|
|
|
|
|
#if WITHIN(MMU2_SERIAL_PORT, 1, 6)
|
|
|
|
|
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
|
|
|
|
|
#elif !defined(USBCON)
|
|
|
|
|
#error "SERIAL_PORT must be from 1 to 6."
|
|
|
|
|
#elif MMU2_SERIAL_PORT == -1
|
|
|
|
|
#define MMU2_SERIAL MSerialUSB
|
|
|
|
|
#else
|
|
|
|
|
#error "MMU2_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
|
|
|
#error "MMU2_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef LCD_SERIAL_PORT
|
|
|
|
|
#if LCD_SERIAL_PORT == -1
|
|
|
|
|
#define LCD_SERIAL MSerial0
|
|
|
|
|
#elif WITHIN(LCD_SERIAL_PORT, 1, 6)
|
|
|
|
|
#if WITHIN(LCD_SERIAL_PORT, 1, 6)
|
|
|
|
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
|
|
|
|
#elif !defined(USBCON)
|
|
|
|
|
#error "SERIAL_PORT must be from 1 to 6."
|
|
|
|
|
#elif LCD_SERIAL_PORT == -1
|
|
|
|
|
#define LCD_SERIAL MSerialUSB
|
|
|
|
|
#else
|
|
|
|
|
#error "LCD_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
|
|
|
|
#error "LCD_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_DGUS_LCD
|
|
|
|
|
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
|
|
|
|