Skip to content

Commit

Permalink
Reverts etc for a better version upgrade experience
Browse files Browse the repository at this point in the history
  • Loading branch information
dok-net committed Mar 5, 2023
1 parent 0408552 commit fa23f02
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 53 deletions.
2 changes: 1 addition & 1 deletion examples/bitpattern/bitpattern.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
6 changes: 3 additions & 3 deletions examples/loopback/loopback.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/onewiretest/onewiretest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/onreceive/onreceive.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions examples/repeater/repeater.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/swsertest/swsertest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
83 changes: 42 additions & 41 deletions src/SoftwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit fa23f02

Please sign in to comment.