Skip to content

Commit

Permalink
Unify defines, new example wouldn't pass CI for ESP8266.
Browse files Browse the repository at this point in the history
  • Loading branch information
dok-net committed Apr 12, 2022
1 parent 1906d2f commit 1e950b2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
22 changes: 15 additions & 7 deletions examples/bitpattern/bitpattern.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@

#ifndef D5
#if defined(ESP8266)
#define D8 (15)
#define D5 (14)
#define D7 (13)
#define D6 (12)
#define RX (3)
#define TX (1)
#elif defined(ESP32)
#define D8 (5)
#define D5 (18)
#define D7 (23)
#define D6 (19)
#define RX (3)
#define TX (1)
#endif
#endif

Expand All @@ -29,22 +37,22 @@ void setup() {
#endif
logSer.begin(115200);
logSer.println(PSTR("\nOne Wire Half Duplex Bitpattern and Datarate Test"));
swSer.begin(115200, SWSERIAL_8N1, D6, -1);
swSer.begin(115200, SWSERIAL_8N1, -1, D5);
swSer.enableIntTx(true);
logSer.println(PSTR("Tx on hwSer"));
logSer.println(PSTR("Tx on swSer"));
}

uint8_t val = 0xff;

void loop() {
hwSer.write((uint8_t)0x00);
hwSer.write(val);
hwSer.write(val);
swSer.write((uint8_t)0x00);
swSer.write(val);
swSer.write(val);
auto start = ESP.getCycleCount();
int rxCnt = 0;
while (ESP.getCycleCount() - start < ESP.getCpuFreqMHz() * 1000000 / 10) {
if (swSer.available()) {
auto rxVal = swSer.read();
if (hwSer.available()) {
auto rxVal = hwSer.read();
if ((!rxCnt && rxVal) || (rxCnt && rxVal != val)) {
logSer.printf(PSTR("Rx bit error: tx = 0x%02x, rx = 0x%02x\n"), val, rxVal);
}
Expand Down
10 changes: 6 additions & 4 deletions examples/loopback/loopback.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@

#ifndef D5
#if defined(ESP8266)
#define D8 (15)
#define D5 (14)
#define D6 (12)
#define D7 (13)
#define D8 (15)
#define D6 (12)
#define RX (3)
#define TX (1)
#elif defined(ESP32)
#define D8 (5)
#define D5 (18)
#define D6 (19)
#define D7 (23)
#define D8 (5)
#define D6 (19)
#define RX (3)
#define TX (1)
#endif
#endif
Expand Down
10 changes: 6 additions & 4 deletions examples/repeater/repeater.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@

#ifndef D5
#if defined(ESP8266)
#define D8 (15)
#define D5 (14)
#define D6 (12)
#define D7 (13)
#define D8 (15)
#define D6 (12)
#define RX (3)
#define TX (1)
#elif defined(ESP32)
#define D8 (5)
#define D5 (18)
#define D6 (19)
#define D7 (23)
#define D8 (5)
#define D6 (19)
#define RX (3)
#define TX (1)
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "EspSoftwareSerial",
"version": "6.16.0",
"version": "6.16.1",
"description": "Implementation of the Arduino software serial for ESP8266/ESP32.",
"keywords": [
"serial", "io", "softwareserial"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=EspSoftwareSerial
version=6.16.0
version=6.16.1
author=Dirk Kaar, Peter Lerup
maintainer=Dirk Kaar <[email protected]>
sentence=Implementation of the Arduino software serial for ESP8266/ESP32.
Expand Down

0 comments on commit 1e950b2

Please sign in to comment.