Skip to content

Commit bbffcd2

Browse files
committed
Updated examples. Requires inverse logic support in ESP8266 HardwareSerial API.
1 parent b1b0438 commit bbffcd2

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

examples/loopback/loopback.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#ifdef ESP32
3434
constexpr int IUTBITRATE = 57600;
3535
#else
36-
constexpr int IUTBITRATE = 153600;
36+
constexpr int IUTBITRATE = 74880;
3737
#endif
3838

3939
#if defined(ESP8266)
@@ -45,6 +45,7 @@ constexpr uint32_t hwSerialConfig = SERIAL_8E1;
4545
#else
4646
constexpr unsigned swSerialConfig = 3;
4747
#endif
48+
constexpr bool invert = false;
4849

4950
constexpr int BLOCKSIZE = 16; // use fractions of 256
5051

@@ -88,7 +89,7 @@ HardwareSerial& logger(Serial);
8889
void setup() {
8990
#if defined(ESP8266)
9091
#if defined(HWLOOPBACK) || defined(HWSOURCESINK) || defined(HWSOURCESWSINK)
91-
Serial.begin(IUTBITRATE, hwSerialConfig);
92+
Serial.begin(IUTBITRATE, hwSerialConfig, SERIAL_FULL, 1, invert);
9293
Serial.swap();
9394
Serial.setRxBufferSize(2 * BLOCKSIZE);
9495
logger.begin(9600, SWSERIAL_8N1, -1, TX);
@@ -97,11 +98,11 @@ void setup() {
9798
#endif
9899
#elif defined(ESP32)
99100
#if defined(HWLOOPBACK) || defined(HWSOURCESWSINK)
100-
Serial2.begin(IUTBITRATE, hwSerialConfig, D4, D3, false);
101+
Serial2.begin(IUTBITRATE, hwSerialConfig, D4, D3, invert);
101102
Serial2.setRxBufferSize(2 * BLOCKSIZE);
102103
logger.begin(9600);
103104
#elif defined(HWSOURCESINK)
104-
serialIUT.begin(IUTBITRATE, hwSerialConfig, D5, D6);
105+
serialIUT.begin(IUTBITRATE, hwSerialConfig, D5, D6, invert);
105106
serialIUT.setRxBufferSize(2 * BLOCKSIZE);
106107
logger.begin(9600);
107108
#else
@@ -113,12 +114,12 @@ void setup() {
113114

114115
#if !defined(HWSOURCESINK)
115116
#if defined(ESP8266)
116-
serialIUT.begin(IUTBITRATE, swSerialConfig, D5, D6, false, 4 * BLOCKSIZE);
117+
serialIUT.begin(IUTBITRATE, swSerialConfig, D5, D6, invert, 4 * BLOCKSIZE);
117118
#ifdef HALFDUPLEX
118119
serialIUT.enableIntTx(false);
119120
#endif
120121
#elif defined(ESP32)
121-
serialIUT.begin(IUTBITRATE, swSerialConfig, D5, D6, false, 2 * BLOCKSIZE);
122+
serialIUT.begin(IUTBITRATE, swSerialConfig, D5, D6, invert, 2 * BLOCKSIZE);
122123
#ifdef HALFDUPLEX
123124
serialIUT.enableIntTx(false);
124125
#endif

examples/repeater/repeater.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
#define D6 (12)
1515
#define D7 (13)
1616
#define D8 (15)
17+
#define TX (1)
1718
#endif
1819

1920
//#define HWLOOPBACK 1
2021
//#define HALFDUPLEX 1
2122

2223
#ifdef ESP32
23-
constexpr int IUTBITRATE = 19200;
24+
constexpr int IUTBITRATE = 57600;
2425
#else
25-
constexpr int IUTBITRATE = 19200;
26+
constexpr int IUTBITRATE = 74880;
2627
#endif
2728

2829
constexpr SoftwareSerialConfig swSerialConfig = SWSERIAL_8N1;

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "EspSoftwareSerial",
3-
"version": "6.2.0",
3+
"version": "6.2.2",
44
"keywords": [
55
"serial", "io", "softwareserial"
66
],

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=EspSoftwareSerial
2-
version=6.2.0
2+
version=6.2.2
33
author=Peter Lerup, Dirk Kaar
44
maintainer=Peter Lerup <peter@lerup.com>
55
sentence=Implementation of the Arduino software serial for ESP8266/ESP32.

0 commit comments

Comments
 (0)