From 2b868aac00825c85feca1b47ac1a47ebf196f3a2 Mon Sep 17 00:00:00 2001 From: Victor Tseng Date: Fri, 29 Dec 2017 22:11:00 +0800 Subject: [PATCH] allow disabling global Serial and Serial1 object (#2807) allow the user to disable specific global `Serial` objects to save memory. that's 0x1c bytes per object. --- cores/esp8266/HardwareSerial.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cores/esp8266/HardwareSerial.cpp b/cores/esp8266/HardwareSerial.cpp index d78b239f1e..f2465be5a6 100644 --- a/cores/esp8266/HardwareSerial.cpp +++ b/cores/esp8266/HardwareSerial.cpp @@ -180,5 +180,10 @@ HardwareSerial::operator bool() const } +#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL) HardwareSerial Serial(UART0); +#endif +#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL1) HardwareSerial Serial1(UART1); +#endif +