diff --git a/examples/bitpattern/bitpattern.ino b/examples/bitpattern/bitpattern.ino index 10c1045..06eb170 100644 --- a/examples/bitpattern/bitpattern.ino +++ b/examples/bitpattern/bitpattern.ino @@ -39,7 +39,7 @@ void setup() { #endif logSer.begin(115200); logSer.println(PSTR("\nOne Wire Half Duplex Bitpattern and Datarate Test")); - swSer.begin(TESTBPS, EspSoftwareSerial::SERIAL_8N1, D6, D5); + swSer.begin(TESTBPS, EspSoftwareSerial::SWSERIAL_8N1, D6, D5); swSer.enableIntTx(true); logSer.println(PSTR("Tx on swSer")); } diff --git a/examples/loopback/loopback.ino b/examples/loopback/loopback.ino index 6495ae8..d72544f 100644 --- a/examples/loopback/loopback.ino +++ b/examples/loopback/loopback.ino @@ -47,10 +47,10 @@ constexpr int IUTBITRATE = 19200; #endif #if defined(ESP8266) -constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SERIAL_8E1; +constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SWSERIAL_8E1; constexpr SerialConfig hwSerialConfig = ::SERIAL_8E1; #elif defined(ESP32) -constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SERIAL_8E1; +constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SWSERIAL_8E1; constexpr uint32_t hwSerialConfig = ::SERIAL_8E1; #else constexpr unsigned swSerialConfig = 3; @@ -102,7 +102,7 @@ void setup() { Serial.begin(IUTBITRATE, hwSerialConfig, ::SERIAL_FULL, 1, invert); Serial.swap(); Serial.setRxBufferSize(2 * BLOCKSIZE); - logger.begin(9600, EspSoftwareSerial::SERIAL_8N1, -1, TX); + logger.begin(9600, EspSoftwareSerial::SWSERIAL_8N1, -1, TX); #else logger.begin(9600); #endif diff --git a/examples/onewiretest/onewiretest.ino b/examples/onewiretest/onewiretest.ino index 2f437ba..69bcff6 100644 --- a/examples/onewiretest/onewiretest.ino +++ b/examples/onewiretest/onewiretest.ino @@ -17,10 +17,10 @@ void setup() { delay(2000); Serial.begin(115200); Serial.println(PSTR("\nOne Wire Half Duplex Serial Tester")); - swSer1.begin(115200, EspSoftwareSerial::SERIAL_8N1, D6, D6, false, 256); + swSer1.begin(115200, EspSoftwareSerial::SWSERIAL_8N1, D6, D6, false, 256); // high speed half duplex, turn off interrupts during tx swSer1.enableIntTx(false); - swSer2.begin(115200, EspSoftwareSerial::SERIAL_8N1, D5, D5, false, 256); + swSer2.begin(115200, EspSoftwareSerial::SWSERIAL_8N1, D5, D5, false, 256); // high speed half duplex, turn off interrupts during tx swSer2.enableIntTx(false); } diff --git a/examples/onreceive/onreceive.ino b/examples/onreceive/onreceive.ino index e737ded..4e5b04a 100644 --- a/examples/onreceive/onreceive.ino +++ b/examples/onreceive/onreceive.ino @@ -30,7 +30,7 @@ void setup() { Serial.begin(115200); Serial.setDebugOutput(false); Serial.swap(); - testSerial.begin(BAUD_RATE, EspSoftwareSerial::SERIAL_8N1, RX, TX); + testSerial.begin(BAUD_RATE, EspSoftwareSerial::SWSERIAL_8N1, RX, TX); // Only half duplex this way, but reliable TX timings for high bps testSerial.enableIntTx(false); testSerial.onReceive(receiveHandler); diff --git a/examples/repeater/repeater.ino b/examples/repeater/repeater.ino index 9f9132d..57a29c0 100644 --- a/examples/repeater/repeater.ino +++ b/examples/repeater/repeater.ino @@ -37,10 +37,10 @@ constexpr int IUTBITRATE = 19200; #endif #if defined(ESP8266) -constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SERIAL_8E1; +constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SWSERIAL_8E1; constexpr SerialConfig hwSerialConfig = ::SERIAL_8E1; #elif defined(ESP32) -constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SERIAL_8E1; +constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SWSERIAL_8E1; constexpr uint32_t hwSerialConfig = ::SERIAL_8E1; #else constexpr unsigned swSerialConfig = 3; @@ -83,7 +83,7 @@ void setup() { repeater.begin(IUTBITRATE, hwSerialConfig, ::SERIAL_FULL, 1, invert); repeater.swap(); repeater.setRxBufferSize(2 * BLOCKSIZE); - logger.begin(9600, EspSoftwareSerial::SERIAL_8N1, -1, TX); + logger.begin(9600, EspSoftwareSerial::SWSERIAL_8N1, -1, TX); #else repeater.begin(IUTBITRATE, swSerialConfig, D7, D8, invert, 4 * BLOCKSIZE); #ifdef HALFDUPLEX diff --git a/examples/swsertest/swsertest.ino b/examples/swsertest/swsertest.ino index bfb52b9..1a24844 100644 --- a/examples/swsertest/swsertest.ino +++ b/examples/swsertest/swsertest.ino @@ -51,12 +51,12 @@ void setup() { // to the loopback EspSoftwareSerial adapter gets read before another write is performed. // Block writes with a size greater than 1 would usually fail. Do not copy this into your own project without // reading the documentation. - testSerial.begin(BAUD_RATE, EspSoftwareSerial::SERIAL_8N1, D7, D8, false, 95, 11); + testSerial.begin(BAUD_RATE, EspSoftwareSerial::SWSERIAL_8N1, D7, D8, false, 95, 11); #else testSerial.begin(115200); testSerial.setDebugOutput(false); testSerial.swap(); - usbSerial.begin(BAUD_RATE, EspSoftwareSerial::SERIAL_8N1, RX, TX, false, 95); + usbSerial.begin(BAUD_RATE, EspSoftwareSerial::SWSERIAL_8N1, RX, TX, false, 95); #endif usbSerial.println(PSTR("\nSoftware serial test started")); diff --git a/src/SoftwareSerial.h b/src/SoftwareSerial.h index 8aea370..93c3498 100644 --- a/src/SoftwareSerial.h +++ b/src/SoftwareSerial.h @@ -111,46 +111,46 @@ enum Parity : uint8_t { }; enum Config { - SERIAL_5N1 = PARITY_NONE, - SERIAL_6N1, - SERIAL_7N1, - SERIAL_8N1, - SERIAL_5E1 = PARITY_EVEN, - SERIAL_6E1, - SERIAL_7E1, - SERIAL_8E1, - SERIAL_5O1 = PARITY_ODD, - SERIAL_6O1, - SERIAL_7O1, - SERIAL_8O1, - SERIAL_5M1 = PARITY_MARK, - SERIAL_6M1, - SERIAL_7M1, - SERIAL_8M1, - SERIAL_5S1 = PARITY_SPACE, - SERIAL_6S1, - SERIAL_7S1, - SERIAL_8S1, - SERIAL_5N2 = 0200 | PARITY_NONE, - SERIAL_6N2, - SERIAL_7N2, - SERIAL_8N2, - SERIAL_5E2 = 0200 | PARITY_EVEN, - SERIAL_6E2, - SERIAL_7E2, - SERIAL_8E2, - SERIAL_5O2 = 0200 | PARITY_ODD, - SERIAL_6O2, - SERIAL_7O2, - SERIAL_8O2, - SERIAL_5M2 = 0200 | PARITY_MARK, - SERIAL_6M2, - SERIAL_7M2, - SERIAL_8M2, - SERIAL_5S2 = 0200 | PARITY_SPACE, - SERIAL_6S2, - SERIAL_7S2, - SERIAL_8S2, + SWSERIAL_5N1 = PARITY_NONE, + SWSERIAL_6N1, + SWSERIAL_7N1, + SWSERIAL_8N1, + SWSERIAL_5E1 = PARITY_EVEN, + SWSERIAL_6E1, + SWSERIAL_7E1, + SWSERIAL_8E1, + SWSERIAL_5O1 = PARITY_ODD, + SWSERIAL_6O1, + SWSERIAL_7O1, + SWSERIAL_8O1, + SWSERIAL_5M1 = PARITY_MARK, + SWSERIAL_6M1, + SWSERIAL_7M1, + SWSERIAL_8M1, + SWSERIAL_5S1 = PARITY_SPACE, + SWSERIAL_6S1, + SWSERIAL_7S1, + SWSERIAL_8S1, + SWSERIAL_5N2 = 0200 | PARITY_NONE, + SWSERIAL_6N2, + SWSERIAL_7N2, + SWSERIAL_8N2, + SWSERIAL_5E2 = 0200 | PARITY_EVEN, + SWSERIAL_6E2, + SWSERIAL_7E2, + SWSERIAL_8E2, + SWSERIAL_5O2 = 0200 | PARITY_ODD, + SWSERIAL_6O2, + SWSERIAL_7O2, + SWSERIAL_8O2, + SWSERIAL_5M2 = 0200 | PARITY_MARK, + SWSERIAL_6M2, + SWSERIAL_7M2, + SWSERIAL_8M2, + SWSERIAL_5S2 = 0200 | PARITY_SPACE, + SWSERIAL_6S2, + SWSERIAL_7S2, + SWSERIAL_8S2, }; /// This class is compatible with the corresponding AVR one, however, @@ -416,7 +416,7 @@ template< class GpioCapabilities > class BasicUART : public UARTBase { int8_t rxPin) { begin(baud, config, rxPin, m_txPin, m_invert); } - void begin(uint32_t baud, Config config = SERIAL_8N1) { + void begin(uint32_t baud, Config config = SWSERIAL_8N1) { begin(baud, config, m_rxPin, m_txPin, m_invert); } void setTransmitEnablePin(int8_t txEnablePin) { @@ -430,6 +430,7 @@ using UART = BasicUART< GpioCapabilities >; }; // namespace EspSoftwareSerial using SoftwareSerial = EspSoftwareSerial::UART; +using namespace EspSoftwareSerial; // The template member functions below must be in IRAM, but due to a bug GCC doesn't currently // honor the attribute. Instead, it is possible to do explicit specialization and adorn