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> #include <stdint.h>
// Serial ports // Define MYSERIAL0/1 before MarlinSerial includes!
#if !WITHIN(SERIAL_PORT, -1, 3) #if SERIAL_PORT == -1
#error "SERIAL_PORT must be from -1 to 3" #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 #endif
// MYSERIAL0 required before MarlinSerial includes!
#define MYSERIAL0 customizedSerial1
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
#if !WITHIN(SERIAL_PORT_2, -1, 3) #if SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be from -1 to 3" #error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == SERIAL_PORT #endif
#error "SERIAL_PORT_2 must be different than SERIAL_PORT" #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 #endif
#define NUM_SERIAL 2 #define NUM_SERIAL 2
#define MYSERIAL1 customizedSerial2
#else #else
#define NUM_SERIAL 1 #define NUM_SERIAL 1
#endif #endif