Skip to content

Commit 156a2dd

Browse files
committed
Some renaming after review feedback.
1 parent ffcec7d commit 156a2dd

File tree

10 files changed

+62
-60
lines changed

10 files changed

+62
-60
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Except at high bitrates, depending on other ongoing activity,
1212
interrupts in particular, this software serial adapter
1313
supports full duplex receive and send. At high bitrates (115200bps)
1414
send bit timing can be improved at the expense of blocking concurrent
15-
full duplex receives, with the `SoftwareSerial::enableIntTx(false)` function call.
15+
full duplex receives, with the
16+
`EspSoftwareSerial::UART::enableIntTx(false)` function call.
1617

1718
The same functionality is given as the corresponding AVR library but
1819
several instances can be active at the same time. Speed up to 115200 baud
@@ -33,7 +34,7 @@ This library supports ESP8266, ESP32, ESP32-S2 and ESP32-C3 devices.
3334

3435
The memory footprint can be optimized to just fit the amount of expected
3536
incoming asynchronous data.
36-
For this, the `SoftwareSerial` constructor provides two arguments. First, the
37+
For this, the `EspSoftwareSerial::UART` constructor provides two arguments. First, the
3738
octet buffer capacity for assembled received octets can be set. Read calls are
3839
satisfied from this buffer, freeing it in return.
3940
Second, the signal edge detection buffer of 32bit fields can be resized.
@@ -75,8 +76,8 @@ chances are that you can reduce the `isrBufCapacity` footprint without losing da
7576
and each time you call read to fetch from the octet buffer, you reduce the
7677
need for space there.
7778

78-
## SoftwareSerialConfig and parity
79-
The configuration of the data stream is done via a `SoftwareSerialConfig`
79+
## EspSoftwareSerial::Config and parity
80+
The configuration of the data stream is done via a `EspSoftwareSerial::Config`
8081
argument to `begin()`. Word lengths can be set to between 5 and 8 bits, parity
8182
can be N(one), O(dd) or E(ven) and 1 or 2 stop bits can be used. The default is
8283
`SWSERIAL_8N1` using 8 bits, no parity and 1 stop bit but any combination can
@@ -92,15 +93,15 @@ individually set in each call to `write()`.
9293

9394
This allows a simple implementation of protocols where the parity bit is used to
9495
distinguish between data and addresses/commands ("9-bit" protocols). First set
95-
up SoftwareSerial with parity mode SPACE, e.g. `SWSERIAL_8S1`. This will add a
96+
up EspSoftwareSerial::UART with parity mode SPACE, e.g. `SWSERIAL_8S1`. This will add a
9697
parity bit to every byte sent, setting it to logical zero (SPACE parity).
9798

9899
To detect incoming bytes with the parity bit set (MARK parity), use the
99100
`readParity()` function. To send a byte with the parity bit set, just add
100101
`MARK` as the second argument when writing, e.g. `write(ch, SWSERIAL_PARITY_MARK)`.
101102

102103
## Checking for correct pin selection / configuration
103-
In general, most pins on the ESP8266 and ESP32 devices can be used by SoftwareSerial,
104+
In general, most pins on the ESP8266 and ESP32 devices can be used by EspSoftwareSerial,
104105
however each device has a number of pins that have special functions or require careful
105106
handling to prevent undesirable situations, for example they are connected to the
106107
on-board SPI flash memory or they are used to determine boot and programming modes
@@ -112,7 +113,7 @@ in sections 2.2 (Pin Descriptions) and 2.4 (Strapping pins). There is a discussi
112113
dedicated to the use of GPIO12 in this
113114
[note about GPIO12](https://github.com/espressif/esp-idf/tree/release/v3.2/examples/storage/sd_card#note-about-gpio12).
114115
Refer to the `isValidPin()`, `isValidRxPin()` and `isValidTxPin()`
115-
functions in the `SoftwareSerialGpioCapabilities` class for the GPIO restrictions
116+
functions in the `EspSoftwareSerial::GpioCapabilities` class for the GPIO restrictions
116117
enforced by this library by default.
117118

118119
The easiest and safest method is to test the object returned at runtime, to see if
@@ -124,15 +125,15 @@ it is valid. For example:
124125
#define MYPORT_TX 12
125126
#define MYPORT_RX 13
126127
127-
SoftwareSerial myPort;
128+
EspSoftwareSerial::UART myPort;
128129
129130
[...]
130131
131132
Serial.begin(115200); // Standard hardware serial port
132133
133134
myPort.begin(38400, SWSERIAL_8N1, MYPORT_RX, MYPORT_TX, false);
134135
if (!myPort) { // If the object did not initialize, then its configuration is invalid
135-
Serial.println("Invalid SoftwareSerial pin configuration, check config");
136+
Serial.println("Invalid EspSoftwareSerial pin configuration, check config");
136137
while (1) { // Don't continue with invalid configuration
137138
delay (1000);
138139
}
@@ -155,7 +156,7 @@ The responsible maintainer of the esp8266 repository has kindly shared the
155156
following command line instructions to use, if one wishes to manually
156157
update EspSoftwareSerial to a newer release than pulled in via the ESP8266 Arduino BSP:
157158

158-
To update esp8266/arduino SoftwareSerial submodule to lastest master:
159+
To update esp8266/arduino EspSoftwareSerial submodule to lastest master:
159160

160161
Clean it (optional):
161162
```shell

examples/bitpattern/bitpattern.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#endif
1919
#endif
2020

21-
SoftwareSerial::UART swSer;
21+
EspSoftwareSerial::UART swSer;
2222
#ifdef ESP8266
23-
auto logSer = SoftwareSerial::UART(-1, TX);
23+
auto logSer = EspSoftwareSerial::UART(-1, TX);
2424
auto hwSer = Serial;
2525
#else
2626
auto logSer = Serial;
@@ -39,7 +39,7 @@ void setup() {
3939
#endif
4040
logSer.begin(115200);
4141
logSer.println(PSTR("\nOne Wire Half Duplex Bitpattern and Datarate Test"));
42-
swSer.begin(TESTBPS, SoftwareSerial::SERIAL_8N1, D6, D5);
42+
swSer.begin(TESTBPS, EspSoftwareSerial::SERIAL_8N1, D6, D5);
4343
swSer.enableIntTx(true);
4444
logSer.println(PSTR("Tx on swSer"));
4545
}

examples/loopback/loopback.ino

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#include <SoftwareSerial.h>
22

33
// On ESP8266:
4-
// Local SoftwareSerial loopback, connect D5 (rx) and D6 (tx).
4+
// Local EspSoftwareSerial loopback, connect D5 (rx) and D6 (tx).
55
// For local hardware loopback, connect D5 to D8 (tx), D6 to D7 (rx).
66
// For hardware send/sink, connect D7 (rx) and D8 (tx).
77
// Hint: The logger is run at 9600bps such that enableIntTx(true) can remain unchanged. Blocking
8-
// interrupts severely impacts the ability of the SoftwareSerial devices to operate concurrently
8+
// interrupts severely impacts the ability of the EspSoftwareSerial devices to operate concurrently
99
// and/or in duplex mode.
1010
// Operating in software serial full duplex mode, runs at 19200bps and few errors (~2.5%).
1111
// Operating in software serial half duplex mode (both loopback and repeater),
1212
// runs at 57600bps with nearly no errors.
1313
// Operating loopback in full duplex, and repeater in half duplex, runs at 38400bps with nearly no errors.
1414
// On ESP32:
15-
// For SoftwareSerial or hardware send/sink, connect D5 (rx) and D6 (tx).
15+
// For EspSoftwareSerial or hardware send/sink, connect D5 (rx) and D6 (tx).
1616
// Hardware Serial2 defaults to D4 (rx), D3 (tx).
1717
// For local hardware loopback, connect D5 (rx) to D3 (tx), D6 (tx) to D4 (rx).
1818

@@ -47,10 +47,10 @@ constexpr int IUTBITRATE = 19200;
4747
#endif
4848

4949
#if defined(ESP8266)
50-
constexpr SoftwareSerial::Config swSerialConfig = SoftwareSerial::SERIAL_8E1;
50+
constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SERIAL_8E1;
5151
constexpr SerialConfig hwSerialConfig = ::SERIAL_8E1;
5252
#elif defined(ESP32)
53-
constexpr SoftwareSerial::Config swSerialConfig = SoftwareSerial::SERIAL_8E1;
53+
constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SERIAL_8E1;
5454
constexpr uint32_t hwSerialConfig = ::SERIAL_8E1;
5555
#else
5656
constexpr unsigned swSerialConfig = 3;
@@ -72,27 +72,27 @@ constexpr int ReportInterval = IUTBITRATE / 8;
7272
#if defined(ESP8266)
7373
#if defined(HWLOOPBACK) || defined(HWSOURCESWSINK)
7474
HardwareSerial& hwSerial(Serial);
75-
SoftwareSerial::UART serialIUT;
76-
SoftwareSerial::UART logger;
75+
EspSoftwareSerial::UART serialIUT;
76+
EspSoftwareSerial::UART logger;
7777
#elif defined(HWSOURCESINK)
7878
HardwareSerial& serialIUT(Serial);
79-
SoftwareSerial::UART logger;
79+
EspSoftwareSerial::UART logger;
8080
#else
81-
SoftwareSerial::UART serialIUT;
81+
EspSoftwareSerial::UART serialIUT;
8282
HardwareSerial& logger(Serial);
8383
#endif
8484
#elif defined(ESP32)
8585
#if defined(HWLOOPBACK) || defined (HWSOURCESWSINK)
8686
HardwareSerial& hwSerial(Serial2);
87-
SoftwareSerial::UART serialIUT;
87+
EspSoftwareSerial::UART serialIUT;
8888
#elif defined(HWSOURCESINK)
8989
HardwareSerial& serialIUT(Serial2);
9090
#else
91-
SoftwareSerial::UART serialIUT;
91+
EspSoftwareSerial::UART serialIUT;
9292
#endif
9393
HardwareSerial& logger(Serial);
9494
#else
95-
SoftwareSerial::UART serialIUT(14, 12);
95+
EspSoftwareSerial::UART serialIUT(14, 12);
9696
HardwareSerial& logger(Serial);
9797
#endif
9898

@@ -102,7 +102,7 @@ void setup() {
102102
Serial.begin(IUTBITRATE, hwSerialConfig, ::SERIAL_FULL, 1, invert);
103103
Serial.swap();
104104
Serial.setRxBufferSize(2 * BLOCKSIZE);
105-
logger.begin(9600, SoftwareSerial::SERIAL_8N1, -1, TX);
105+
logger.begin(9600, EspSoftwareSerial::SERIAL_8N1, -1, TX);
106106
#else
107107
logger.begin(9600);
108108
#endif
@@ -134,7 +134,7 @@ void setup() {
134134
logger.begin(9600);
135135
#endif
136136

137-
logger.println(PSTR("Loopback example for EspSoftwareSerial"));
137+
logger.println(PSTR("Loopback example for EspEspSoftwareSerial"));
138138

139139
start = micros();
140140
txCount = 0;

examples/onewiretest/onewiretest.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
#endif
1111
#endif
1212

13-
SoftwareSerial::UART swSer1;
14-
SoftwareSerial::UART swSer2;
13+
EspSoftwareSerial::UART swSer1;
14+
EspSoftwareSerial::UART swSer2;
1515

1616
void setup() {
1717
delay(2000);
1818
Serial.begin(115200);
1919
Serial.println(PSTR("\nOne Wire Half Duplex Serial Tester"));
20-
swSer1.begin(115200, SoftwareSerial::SERIAL_8N1, D6, D6, false, 256);
20+
swSer1.begin(115200, EspSoftwareSerial::SERIAL_8N1, D6, D6, false, 256);
2121
// high speed half duplex, turn off interrupts during tx
2222
swSer1.enableIntTx(false);
23-
swSer2.begin(115200, SoftwareSerial::SERIAL_8N1, D5, D5, false, 256);
23+
swSer2.begin(115200, EspSoftwareSerial::SERIAL_8N1, D5, D5, false, 256);
2424
// high speed half duplex, turn off interrupts during tx
2525
swSer2.enableIntTx(false);
2626
}
@@ -36,7 +36,7 @@ void loop() {
3636

3737
}
3838

39-
void checkSwSerial(SoftwareSerial::UART* ss) {
39+
void checkSwSerial(EspSoftwareSerial::UART* ss) {
4040
byte ch;
4141
while (!Serial.available());
4242
ss->enableTx(true);
@@ -45,7 +45,7 @@ void checkSwSerial(SoftwareSerial::UART* ss) {
4545
ss->write(ch);
4646
}
4747
ss->enableTx(false);
48-
// wait 1 second for the reply from SoftwareSerial if any
48+
// wait 1 second for the reply from EspSoftwareSerial if any
4949
delay(1000);
5050
if (ss->available()) {
5151
Serial.print(PSTR("\nResult:"));

examples/onreceive/onreceive.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define BAUD_RATE 115200
1717
#define MAX_FRAMEBITS (1 + 8 + 1 + 2)
1818

19-
SoftwareSerial::UART testSerial;
19+
EspSoftwareSerial::UART testSerial;
2020

2121
// Becomes set from ISR / IRQ callback function.
2222
std::atomic<bool> rxPending(false);
@@ -30,7 +30,7 @@ void setup() {
3030
Serial.begin(115200);
3131
Serial.setDebugOutput(false);
3232
Serial.swap();
33-
testSerial.begin(BAUD_RATE, SoftwareSerial::SERIAL_8N1, RX, TX);
33+
testSerial.begin(BAUD_RATE, EspSoftwareSerial::SERIAL_8N1, RX, TX);
3434
// Only half duplex this way, but reliable TX timings for high bps
3535
testSerial.enableIntTx(false);
3636
testSerial.onReceive(receiveHandler);

examples/repeater/repeater.ino

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include <SoftwareSerial.h>
22

33
// On ESP8266:
4-
// SoftwareSerial loopback for remote source (loopback.ino), or hardware loopback.
4+
// EspSoftwareSerial loopback for remote source (loopback.ino), or hardware loopback.
55
// Connect source D5 (rx) to local D8 (tx), source D6 (tx) to local D7 (rx).
66
// Hint: The logger is run at 9600bps such that enableIntTx(true) can remain unchanged. Blocking
7-
// interrupts severely impacts the ability of the SoftwareSerial devices to operate concurrently
7+
// interrupts severely impacts the ability of the EspSoftwareSerial devices to operate concurrently
88
// and/or in duplex mode.
99
// On ESP32:
1010
// For software or hardware loopback, connect source rx to local D8 (tx), source tx to local D7 (rx).
@@ -37,10 +37,10 @@ constexpr int IUTBITRATE = 19200;
3737
#endif
3838

3939
#if defined(ESP8266)
40-
constexpr SoftwareSerial::Config swSerialConfig = SoftwareSerial::SERIAL_8E1;
40+
constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SERIAL_8E1;
4141
constexpr SerialConfig hwSerialConfig = ::SERIAL_8E1;
4242
#elif defined(ESP32)
43-
constexpr SoftwareSerial::Config swSerialConfig = SoftwareSerial::SERIAL_8E1;
43+
constexpr EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SERIAL_8E1;
4444
constexpr uint32_t hwSerialConfig = ::SERIAL_8E1;
4545
#else
4646
constexpr unsigned swSerialConfig = 3;
@@ -60,20 +60,20 @@ constexpr int ReportInterval = IUTBITRATE / 8;
6060
#if defined(ESP8266)
6161
#if defined(HWLOOPBACK)
6262
HardwareSerial& repeater(Serial);
63-
SoftwareSerial::UART logger;
63+
EspSoftwareSerial::UART logger;
6464
#else
65-
SoftwareSerial::UART repeater;
65+
EspSoftwareSerial::UART repeater;
6666
HardwareSerial& logger(Serial);
6767
#endif
6868
#elif defined(ESP32)
6969
#if defined(HWLOOPBACK)
7070
HardwareSerial& repeater(Serial2);
7171
#else
72-
SoftwareSerial::UART repeater;
72+
EspSoftwareSerial::UART repeater;
7373
#endif
7474
HardwareSerial& logger(Serial);
7575
#else
76-
SoftwareSerial::UART repeater(14, 12);
76+
EspSoftwareSerial::UART repeater(14, 12);
7777
HardwareSerial& logger(Serial);
7878
#endif
7979

@@ -83,7 +83,7 @@ void setup() {
8383
repeater.begin(IUTBITRATE, hwSerialConfig, ::SERIAL_FULL, 1, invert);
8484
repeater.swap();
8585
repeater.setRxBufferSize(2 * BLOCKSIZE);
86-
logger.begin(9600, SoftwareSerial::SERIAL_8N1, -1, TX);
86+
logger.begin(9600, EspSoftwareSerial::SERIAL_8N1, -1, TX);
8787
#else
8888
repeater.begin(IUTBITRATE, swSerialConfig, D7, D8, invert, 4 * BLOCKSIZE);
8989
#ifdef HALFDUPLEX
@@ -107,7 +107,7 @@ void setup() {
107107
logger.begin(9600);
108108
#endif
109109

110-
logger.println(PSTR("Repeater example for EspSoftwareSerial"));
110+
logger.println(PSTR("Repeater example for EspEspSoftwareSerial"));
111111
start = micros();
112112
rxCount = 0;
113113
seqErrors = 0;

examples/swsertest/swsertest.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737

3838
#ifndef SWAPSERIAL
3939
auto& usbSerial = Serial;
40-
SoftwareSerial::UART testSerial;
40+
EspSoftwareSerial::UART testSerial;
4141
#else
42-
SoftwareSerial::UART usbSerial;
42+
EspSoftwareSerial::UART usbSerial;
4343
auto& testSerial = Serial;
4444
#endif
4545

@@ -48,15 +48,15 @@ void setup() {
4848
usbSerial.begin(115200);
4949
// Important: the buffer size optimizations here, in particular the isrBufSize (11) that is only sufficiently
5050
// large to hold a single word (up to start - 8 data - parity - stop), are on the basis that any char written
51-
// to the loopback SoftwareSerial adapter gets read before another write is performed.
51+
// to the loopback EspSoftwareSerial adapter gets read before another write is performed.
5252
// Block writes with a size greater than 1 would usually fail. Do not copy this into your own project without
5353
// reading the documentation.
54-
testSerial.begin(BAUD_RATE, SoftwareSerial::SERIAL_8N1, D7, D8, false, 95, 11);
54+
testSerial.begin(BAUD_RATE, EspSoftwareSerial::SERIAL_8N1, D7, D8, false, 95, 11);
5555
#else
5656
testSerial.begin(115200);
5757
testSerial.setDebugOutput(false);
5858
testSerial.swap();
59-
usbSerial.begin(BAUD_RATE, SoftwareSerial::SERIAL_8N1, RX, TX, false, 95);
59+
usbSerial.begin(BAUD_RATE, EspSoftwareSerial::SERIAL_8N1, RX, TX, false, 95);
6060
#endif
6161

6262
usbSerial.println(PSTR("\nSoftware serial test started"));

keywords.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#######################################
2-
# Syntax Coloring Map for SoftwareSerial
2+
# Syntax Coloring Map for EspSoftwareSerial
33
# (esp8266)
44
#######################################
55

66
#######################################
77
# Datatypes (KEYWORD1)
88
#######################################
99

10+
EspSoftwareSerial KEYWORD1
1011
SoftwareSerial KEYWORD1
1112

1213
#######################################

src/SoftwareSerial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323
#include "SoftwareSerial.h"
2424
#include <Arduino.h>
2525

26-
using namespace SoftwareSerial;
26+
using namespace EspSoftwareSerial;
2727

2828
constexpr bool GpioCapabilities::isValidPin(int8_t pin) {
2929
#if defined(ESP8266)

0 commit comments

Comments
 (0)