mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 05:48:43 +00:00
Don't create unused Serial Port instances (#21066)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
98a27bff0d
commit
8fd88eee2b
@ -102,11 +102,18 @@ uint16_t HAL_adc_get_result() {
|
|||||||
return HAL_adc_result;
|
return HAL_adc_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forward the default serial port
|
// Forward the default serial ports
|
||||||
DefaultSerial MSerial(false, Serial);
|
#if ANY_SERIAL_IS(0)
|
||||||
|
DefaultSerial MSerial(false, Serial);
|
||||||
DefaultSerial1 MSerial1(false, Serial1);
|
#endif
|
||||||
DefaultSerial2 MSerial2(false, Serial2);
|
#if ANY_SERIAL_IS(1)
|
||||||
DefaultSerial3 MSerial3(false, Serial3);
|
DefaultSerial1 MSerial1(false, Serial1);
|
||||||
|
#endif
|
||||||
|
#if ANY_SERIAL_IS(2)
|
||||||
|
DefaultSerial2 MSerial2(false, Serial2);
|
||||||
|
#endif
|
||||||
|
#if ANY_SERIAL_IS(3)
|
||||||
|
DefaultSerial3 MSerial3(false, Serial3);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // ARDUINO_ARCH_SAM
|
#endif // ARDUINO_ARCH_SAM
|
||||||
|
@ -37,12 +37,12 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "../../core/serial_hook.h"
|
#include "../../core/serial_hook.h"
|
||||||
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
|
|
||||||
extern DefaultSerial MSerial;
|
|
||||||
|
|
||||||
|
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
|
||||||
typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1;
|
typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1;
|
||||||
typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2;
|
typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2;
|
||||||
typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3;
|
typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3;
|
||||||
|
extern DefaultSerial MSerial;
|
||||||
extern DefaultSerial1 MSerial1;
|
extern DefaultSerial1 MSerial1;
|
||||||
extern DefaultSerial2 MSerial2;
|
extern DefaultSerial2 MSerial2;
|
||||||
extern DefaultSerial3 MSerial3;
|
extern DefaultSerial3 MSerial3;
|
||||||
|
@ -25,8 +25,21 @@
|
|||||||
#include <wiring_private.h>
|
#include <wiring_private.h>
|
||||||
|
|
||||||
#ifdef ADAFRUIT_GRAND_CENTRAL_M4
|
#ifdef ADAFRUIT_GRAND_CENTRAL_M4
|
||||||
|
#if ANY_SERIAL_IS(-1)
|
||||||
DefaultSerial MSerial(false, Serial);
|
DefaultSerial MSerial(false, Serial);
|
||||||
|
#endif
|
||||||
|
#if ANY_SERIAL_IS(0)
|
||||||
DefaultSerial1 MSerial1(false, Serial1);
|
DefaultSerial1 MSerial1(false, Serial1);
|
||||||
|
#endif
|
||||||
|
#if ANY_SERIAL_IS(1)
|
||||||
|
DefaultSerial2 MSerial2(false, Serial2);
|
||||||
|
#endif
|
||||||
|
#if ANY_SERIAL_IS(2)
|
||||||
|
DefaultSerial3 MSerial3(false, Serial3);
|
||||||
|
#endif
|
||||||
|
#if ANY_SERIAL_IS(3)
|
||||||
|
DefaultSerial4 MSerial4(false, Serial4);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
@ -33,9 +33,15 @@
|
|||||||
|
|
||||||
// Serial ports
|
// Serial ports
|
||||||
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
|
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
|
||||||
extern DefaultSerial MSerial;
|
|
||||||
typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1;
|
typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1;
|
||||||
|
typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2;
|
||||||
|
typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3;
|
||||||
|
typedef ForwardSerial0Type< decltype(Serial4) > DefaultSerial4;
|
||||||
|
extern DefaultSerial MSerial;
|
||||||
extern DefaultSerial1 MSerial1;
|
extern DefaultSerial1 MSerial1;
|
||||||
|
extern DefaultSerial2 MSerial2;
|
||||||
|
extern DefaultSerial3 MSerial3;
|
||||||
|
extern DefaultSerial4 MSerial4;
|
||||||
|
|
||||||
// MYSERIAL0 required before MarlinSerial includes!
|
// MYSERIAL0 required before MarlinSerial includes!
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user