Fix DUE HAL serial defines (#15536)

This commit is contained in:
Bo Herrmannsen 2019-10-14 00:06:15 +02:00 committed by Scott Lahteine
parent 62aa137548
commit 5ad9257df4

View File

@ -38,22 +38,39 @@
#include <stdint.h>
// Serial ports
#if !WITHIN(SERIAL_PORT, -1, 3)
#error "SERIAL_PORT must be from -1 to 3"
// Define MYSERIAL0/1 before MarlinSerial includes!
#if SERIAL_PORT == -1
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial
#elif SERIAL_PORT == 1
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 2
#define MYSERIAL0 Serial2
#elif SERIAL_PORT == 3
#define MYSERIAL0 Serial3
#else
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif
// MYSERIAL0 required before MarlinSerial includes!
#define MYSERIAL0 customizedSerial1
#ifdef SERIAL_PORT_2
#if !WITHIN(SERIAL_PORT_2, -1, 3)
#error "SERIAL_PORT_2 must be from -1 to 3"
#elif SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
#if SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
#endif
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 Serial
#elif SERIAL_PORT_2 == 1
#define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 2
#define MYSERIAL1 Serial2
#elif SERIAL_PORT_2 == 3
#define MYSERIAL1 Serial3
#else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#endif
#define NUM_SERIAL 2
#define MYSERIAL1 customizedSerial2
#else
#define NUM_SERIAL 1
#endif