diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 136f5e6..6680a1d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -15,8 +15,8 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
Please ensure to specify the following:
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
-* `Teensyduino` Core Version (e.g. `Teensyduino core v1.56`)
-* `QNEthernet` library version (e.g. `QNEthernet v0.13.0`)
+* `Teensyduino` Core Version (e.g. `Teensyduino core v1.57`)
+* `QNEthernet` library version (e.g. `QNEthernet v0.16.0`)
* Board type and relevant info
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
@@ -29,13 +29,13 @@ Please ensure to specify the following:
```
Arduino IDE version: 1.8.19
-Teensyduino core v1.56
-Teensy 4.1 using QNEthernet v0.13.0
+Teensyduino core v1.57
+Teensy 4.1 using QNEthernet v0.16.0
OS: Ubuntu 20.04 LTS
-Linux xy-Inspiron-3593 5.13.0-35-generic #40~20.04.1-Ubuntu SMP Mon Mar 7 09:18:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
+Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Context:
-I encountered an endless loop while trying to connect to Local WiFi.
+I encountered a crash while using this library
Steps to reproduce:
1. ...
@@ -43,13 +43,33 @@ Steps to reproduce:
3. ...
4. ...
```
+
+---
+
### Sending Feature Requests
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
-There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/AsyncUDP_Teensy41/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
+There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/RP2040_PWM/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
+
+---
### Sending Pull Requests
Pull Requests with changes and fixes are also welcome!
+Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
+
+1. Change directory to the library GitHub
+
+```
+xy@xy-Inspiron-3593:~$ cd Arduino/xy/RP2040_PWM_GitHub/
+xy@xy-Inspiron-3593:~/Arduino/xy/RP2040_PWM_GitHub$
+```
+
+2. Issue astyle command
+
+```
+xy@xy-Inspiron-3593:~/Arduino/xy/RP2040_PWM_GitHub$ bash utils/restyle.sh
+```
+
diff --git a/changelog.md b/changelog.md
index 6440d34..7a45467 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,10 +1,16 @@
-# AsyncUDP_Teensy41
+# AsyncUDP_Teensy41 Library
[![arduino-library-badge](https://www.ardu-badge.com/badge/AsyncUDP_Teensy41.svg?)](https://www.ardu-badge.com/AsyncUDP_Teensy41)
[![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncUDP_Teensy41.svg)](https://github.com/khoih-prog/AsyncUDP_Teensy41/releases)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/AsyncUDP_Teensy41.svg)](http://github.com/khoih-prog/AsyncUDP_Teensy41/issues)
+
+
+
+
+
+
---
---
diff --git a/examples/AsyncUDPClient/AsyncUDPClient.ino b/examples/AsyncUDPClient/AsyncUDPClient.ino
index 484a2c1..7d0645f 100644
--- a/examples/AsyncUDPClient/AsyncUDPClient.ino
+++ b/examples/AsyncUDPClient/AsyncUDPClient.ino
@@ -2,9 +2,9 @@
Async_UdpClient.ino
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
@@ -30,12 +30,12 @@ AsyncUDP udp;
void sendRequest();
// Repeat forever, millis() resolution
-Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
+Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
void sendRequest()
{
UDP_LOGDEBUG1("Send broadcastTo port ", UDP_REMOTE_PORT);
-
+
udp.broadcastTo("Anyone here?", UDP_REMOTE_PORT);
}
@@ -63,18 +63,22 @@ void parsePacket(AsyncUDPPacket packet)
void setup()
{
Serial.begin(115200);
+
while (!Serial);
- Serial.print("\nStart Async_UDPClient on "); Serial.println(BOARD_NAME);
+ Serial.print("\nStart Async_UDPClient on ");
+ Serial.println(BOARD_NAME);
Serial.println(ASYNC_UDP_TEENSY41_VERSION);
#if defined(ASYNC_UDP_TEENSY41_VERSION_MIN)
+
if (ASYNC_UDP_TEENSY41_VERSION_INT < ASYNC_UDP_TEENSY41_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(ASYNC_UDP_TEENSY41_VERSION_MIN_TARGET);
}
-#endif
+
+#endif
delay(500);
@@ -106,12 +110,13 @@ void setup()
}
else
{
- Serial.print(F("Connected! IP address:")); Serial.println(Ethernet.localIP());
+ Serial.print(F("Connected! IP address:"));
+ Serial.println(Ethernet.localIP());
}
#if USING_DHCP
delay(1000);
-#else
+#else
delay(2000);
#endif
diff --git a/examples/AsyncUDPClient/defines.h b/examples/AsyncUDPClient/defines.h
index c8e9336..ae0ae2c 100644
--- a/examples/AsyncUDPClient/defines.h
+++ b/examples/AsyncUDPClient/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
diff --git a/examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino b/examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino
index 33b6e83..4534ef4 100644
--- a/examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino
+++ b/examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino
@@ -2,13 +2,13 @@
AsyncUDPMulticastServer.ino
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
-
+
#include "defines.h"
#define ASYNC_UDP_TEENSY41_VERSION_MIN_TARGET "AsyncUDP_Teensy41 v1.2.1"
@@ -26,12 +26,12 @@ AsyncUDP udp;
void sendRequest();
// Repeat forever, millis() resolution
-Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
+Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
void sendRequest()
{
UDP_LOGDEBUG("Send multicast");
-
+
//Send multicast
udp.print("Anyone here?");
}
@@ -60,18 +60,22 @@ void parsePacket(AsyncUDPPacket packet)
void setup()
{
Serial.begin(115200);
+
while (!Serial);
- Serial.print("\nStart AsyncUDPMulticastServer on "); Serial.println(BOARD_NAME);
+ Serial.print("\nStart AsyncUDPMulticastServer on ");
+ Serial.println(BOARD_NAME);
Serial.println(ASYNC_UDP_TEENSY41_VERSION);
#if defined(ASYNC_UDP_TEENSY41_VERSION_MIN)
+
if (ASYNC_UDP_TEENSY41_VERSION_INT < ASYNC_UDP_TEENSY41_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(ASYNC_UDP_TEENSY41_VERSION_MIN_TARGET);
}
-#endif
+
+#endif
delay(500);
@@ -103,12 +107,13 @@ void setup()
}
else
{
- Serial.print(F("Connected! IP address:")); Serial.println(Ethernet.localIP());
+ Serial.print(F("Connected! IP address:"));
+ Serial.println(Ethernet.localIP());
}
#if USING_DHCP
delay(1000);
-#else
+#else
delay(2000);
#endif
diff --git a/examples/AsyncUDPMulticastServer/defines.h b/examples/AsyncUDPMulticastServer/defines.h
index c8e9336..ae0ae2c 100644
--- a/examples/AsyncUDPMulticastServer/defines.h
+++ b/examples/AsyncUDPMulticastServer/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
diff --git a/examples/AsyncUDPServer/AsyncUDPServer.ino b/examples/AsyncUDPServer/AsyncUDPServer.ino
index 13b21b0..e4a5079 100644
--- a/examples/AsyncUDPServer/AsyncUDPServer.ino
+++ b/examples/AsyncUDPServer/AsyncUDPServer.ino
@@ -2,9 +2,9 @@
Async_UdpServer.ino
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
@@ -26,30 +26,34 @@ AsyncUDP udp;
void sendRequest();
// Repeat forever, millis() resolution
-Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
+Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
void sendRequest()
{
UDP_LOGDEBUG("Send broadcast");
-
+
udp.broadcast("Anyone here?");
}
void setup()
{
Serial.begin(115200);
+
while (!Serial);
-
- Serial.print("\nStart AsyncUDPServer on "); Serial.println(BOARD_NAME);
+
+ Serial.print("\nStart AsyncUDPServer on ");
+ Serial.println(BOARD_NAME);
Serial.println(ASYNC_UDP_TEENSY41_VERSION);
#if defined(ASYNC_UDP_TEENSY41_VERSION_MIN)
+
if (ASYNC_UDP_TEENSY41_VERSION_INT < ASYNC_UDP_TEENSY41_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(ASYNC_UDP_TEENSY41_VERSION_MIN_TARGET);
}
-#endif
+
+#endif
delay(500);
@@ -81,21 +85,22 @@ void setup()
}
else
{
- Serial.print(F("Connected! IP address:")); Serial.println(Ethernet.localIP());
+ Serial.print(F("Connected! IP address:"));
+ Serial.println(Ethernet.localIP());
}
#if USING_DHCP
delay(1000);
-#else
+#else
delay(2000);
#endif
-
- if (udp.listen(1234))
+
+ if (udp.listen(1234))
{
Serial.print("UDP Listening on IP: ");
Serial.println(Ethernet.localIP());
-
- udp.onPacket([](AsyncUDPPacket packet)
+
+ udp.onPacket([](AsyncUDPPacket packet)
{
Serial.print("UDP Packet Type: ");
Serial.print(packet.isBroadcast() ? "Broadcast" : packet.isMulticast() ? "Multicast" : "Unicast");
@@ -117,7 +122,7 @@ void setup()
});
}
- sendRequest();
+ sendRequest();
sendUDPRequest.start(); //start the ticker
}
diff --git a/examples/AsyncUDPServer/defines.h b/examples/AsyncUDPServer/defines.h
index c8e9336..ae0ae2c 100644
--- a/examples/AsyncUDPServer/defines.h
+++ b/examples/AsyncUDPServer/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
diff --git a/examples/AsyncUdpNTPClient/AsyncUdpNTPClient.ino b/examples/AsyncUdpNTPClient/AsyncUdpNTPClient.ino
index 772bb67..e3dc394 100644
--- a/examples/AsyncUdpNTPClient/AsyncUdpNTPClient.ino
+++ b/examples/AsyncUdpNTPClient/AsyncUdpNTPClient.ino
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
AsyncUdpNTPClient.ino
-
+
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
@@ -37,7 +37,7 @@ AsyncUDP Udp;
void sendNTPPacket();
// Repeat forever, millis() resolution
-Ticker sendUDPRequest(sendNTPPacket, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
+Ticker sendUDPRequest(sendNTPPacket, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
// send an NTP request to the time server at the given address
void createNTPpacket(void)
@@ -53,7 +53,7 @@ void createNTPpacket(void)
packetBuffer[1] = 0; // Stratum, or type of clock
packetBuffer[2] = 6; // Polling Interval
packetBuffer[3] = 0xEC; // Peer Clock Precision
-
+
// 8 bytes of zero for Root Delay & Root Dispersion
packetBuffer[12] = 49;
packetBuffer[13] = 0x4E;
@@ -65,7 +65,7 @@ void parsePacket(AsyncUDPPacket packet)
{
struct tm ts;
char buf[80];
-
+
memcpy(packetBuffer, packet.data(), sizeof(packetBuffer));
Serial.print("Received UDP Packet Type: ");
@@ -88,20 +88,20 @@ void parsePacket(AsyncUDPPacket packet)
// combine the four bytes (two words) into a long integer
// this is NTP time (seconds since Jan 1 1900):
unsigned long secsSince1900 = highWord << 16 | lowWord;
-
+
Serial.print(F("Seconds since Jan 1 1900 = "));
Serial.println(secsSince1900);
// now convert NTP time into )everyday time:
Serial.print(F("Epoch/Unix time = "));
-
+
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
const unsigned long seventyYears = 2208988800UL;
-
+
// subtract seventy years:
unsigned long epoch = secsSince1900 - seventyYears;
time_t epoch_t = epoch; //secsSince1900 - seventyYears;
-
+
// print Unix time:
Serial.println(epoch);
@@ -123,18 +123,22 @@ void sendNTPPacket()
void setup()
{
Serial.begin(115200);
+
while (!Serial);
- Serial.print("\nStart AsyncUdpNTPClient on "); Serial.println(BOARD_NAME);
+ Serial.print("\nStart AsyncUdpNTPClient on ");
+ Serial.println(BOARD_NAME);
Serial.println(ASYNC_UDP_TEENSY41_VERSION);
#if defined(ASYNC_UDP_TEENSY41_VERSION_MIN)
+
if (ASYNC_UDP_TEENSY41_VERSION_INT < ASYNC_UDP_TEENSY41_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(ASYNC_UDP_TEENSY41_VERSION_MIN_TARGET);
}
-#endif
+
+#endif
delay(500);
@@ -166,19 +170,20 @@ void setup()
}
else
{
- Serial.print(F("Connected! IP address:")); Serial.println(Ethernet.localIP());
+ Serial.print(F("Connected! IP address:"));
+ Serial.println(Ethernet.localIP());
}
#if USING_DHCP
delay(1000);
-#else
+#else
delay(2000);
#endif
//NTP requests are to port NTP_REQUEST_PORT = 123
if (Udp.connect(timeServerIP, NTP_REQUEST_PORT))
- //if (Udp.connect(timeServer, NTP_REQUEST_PORT))
+ //if (Udp.connect(timeServer, NTP_REQUEST_PORT))
{
Serial.println("UDP connected");
diff --git a/examples/AsyncUdpNTPClient/defines.h b/examples/AsyncUdpNTPClient/defines.h
index c983dd2..0003eb5 100644
--- a/examples/AsyncUdpNTPClient/defines.h
+++ b/examples/AsyncUdpNTPClient/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
diff --git a/examples/AsyncUdpSendReceive/AsyncUdpSendReceive.ino b/examples/AsyncUdpSendReceive/AsyncUdpSendReceive.ino
index 88690d4..bf7b896 100644
--- a/examples/AsyncUdpSendReceive/AsyncUdpSendReceive.ino
+++ b/examples/AsyncUdpSendReceive/AsyncUdpSendReceive.ino
@@ -2,9 +2,9 @@
AsyncUDPSendReceive.ino
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
@@ -36,13 +36,13 @@ AsyncUDP Udp;
void sendNTPPacket();
// Repeat forever, millis() resolution
-Ticker sendUDPRequest(sendNTPPacket, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
+Ticker sendUDPRequest(sendNTPPacket, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
void sendACKPacket()
{
Serial.println("============= sendACKPacket =============");
-
+
// Send unicast ACK to the same remoteIP and remotePort we received the packet
// The AsyncUDP_STM32 library will take care of the correct IP and port based on pcb
Udp.write((uint8_t *) ReplyBuffer, sizeof(ReplyBuffer));
@@ -62,7 +62,7 @@ void createNTPpacket()
packetBuffer[1] = 0; // Stratum, or type of clock
packetBuffer[2] = 6; // Polling Interval
packetBuffer[3] = 0xEC; // Peer Clock Precision
-
+
// 8 bytes of zero for Root Delay & Root Dispersion
packetBuffer[12] = 49;
packetBuffer[13] = 0x4E;
@@ -81,7 +81,7 @@ void parsePacket(AsyncUDPPacket packet)
{
struct tm ts;
char buf[80];
-
+
memcpy(packetBuffer, packet.data(), sizeof(packetBuffer));
Serial.print("Received UDP Packet Type: ");
@@ -104,20 +104,20 @@ void parsePacket(AsyncUDPPacket packet)
// combine the four bytes (two words) into a long integer
// this is NTP time (seconds since Jan 1 1900):
unsigned long secsSince1900 = highWord << 16 | lowWord;
-
+
Serial.print(F("Seconds since Jan 1 1900 = "));
Serial.println(secsSince1900);
// now convert NTP time into )everyday time:
Serial.print(F("Epoch/Unix time = "));
-
+
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
const unsigned long seventyYears = 2208988800UL;
-
+
// subtract seventy years:
unsigned long epoch = secsSince1900 - seventyYears;
time_t epoch_t = epoch; //secsSince1900 - seventyYears;
-
+
// print Unix time:
Serial.println(epoch);
@@ -135,18 +135,22 @@ void parsePacket(AsyncUDPPacket packet)
void setup()
{
Serial.begin(115200);
+
while (!Serial);
- Serial.print("\nStart AsyncUDPSendReceive on "); Serial.println(BOARD_NAME);
+ Serial.print("\nStart AsyncUDPSendReceive on ");
+ Serial.println(BOARD_NAME);
Serial.println(ASYNC_UDP_TEENSY41_VERSION);
#if defined(ASYNC_UDP_TEENSY41_VERSION_MIN)
+
if (ASYNC_UDP_TEENSY41_VERSION_INT < ASYNC_UDP_TEENSY41_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(ASYNC_UDP_TEENSY41_VERSION_MIN_TARGET);
}
-#endif
+
+#endif
delay(500);
@@ -178,12 +182,13 @@ void setup()
}
else
{
- Serial.print(F("Connected! IP address:")); Serial.println(Ethernet.localIP());
+ Serial.print(F("Connected! IP address:"));
+ Serial.println(Ethernet.localIP());
}
#if USING_DHCP
delay(1000);
-#else
+#else
delay(2000);
#endif
diff --git a/examples/AsyncUdpSendReceive/defines.h b/examples/AsyncUdpSendReceive/defines.h
index c983dd2..0003eb5 100644
--- a/examples/AsyncUdpSendReceive/defines.h
+++ b/examples/AsyncUdpSendReceive/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
diff --git a/examples/multiFileProject/multiFileProject.cpp b/examples/multiFileProject/multiFileProject.cpp
index e599cb2..a225189 100644
--- a/examples/multiFileProject/multiFileProject.cpp
+++ b/examples/multiFileProject/multiFileProject.cpp
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.cpp
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
diff --git a/examples/multiFileProject/multiFileProject.h b/examples/multiFileProject/multiFileProject.h
index b56b7dc..ffafa43 100644
--- a/examples/multiFileProject/multiFileProject.h
+++ b/examples/multiFileProject/multiFileProject.h
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.h
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
diff --git a/examples/multiFileProject/multiFileProject.ino b/examples/multiFileProject/multiFileProject.ino
index 34ca272..211244f 100644
--- a/examples/multiFileProject/multiFileProject.ino
+++ b/examples/multiFileProject/multiFileProject.ino
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.ino
For Teensy41 with QNEthernet
-
+
AsyncUDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_Teensy41
*****************************************************************************************************************************/
@@ -28,28 +28,31 @@
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include // https://github.com/khoih-prog/AsyncUDP_Teensy41
-void setup()
+void setup()
{
Serial.begin(115200);
+
while (!Serial);
delay(500);
-
+
Serial.println("\nStart multiFileProject");
Serial.println(ASYNC_UDP_TEENSY41_VERSION);
#if defined(ASYNC_UDP_TEENSY41_VERSION_MIN)
+
if (ASYNC_UDP_TEENSY41_VERSION_INT < ASYNC_UDP_TEENSY41_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(ASYNC_UDP_TEENSY41_VERSION_MIN_TARGET);
}
+
#endif
Serial.print("You're OK now");
}
-void loop()
+void loop()
{
// put your main code here, to run repeatedly:
}
diff --git a/platformio/platformio.ini b/platformio/platformio.ini
index 497cceb..2dd17ca 100644
--- a/platformio/platformio.ini
+++ b/platformio/platformio.ini
@@ -28,6 +28,8 @@ upload_speed = 921600
; Checks for the compatibility with frameworks and dev/platforms
lib_compat_mode = strict
+lib_ldf_mode = chain+
+;lib_ldf_mode = deep+
lib_deps =
; PlatformIO 4.x
diff --git a/src/AsyncUDP_Teensy41.h b/src/AsyncUDP_Teensy41.h
index 7e93c30..83c2c74 100644
--- a/src/AsyncUDP_Teensy41.h
+++ b/src/AsyncUDP_Teensy41.h
@@ -1,19 +1,19 @@
/****************************************************************************************************************************
AsyncUDP_Teensy41.h
-
+
For Teensy41 with QNEthernet
-
+
ASYNC_UDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Teensy41
-
+
Version: 1.2.1
-
+
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.1 K Hoang 18/03/2022 Initial coding for Teensy 4.1 using built-in QNEthernet.
- Bump up version to v1.2.1 to sync with ASYNC_UDP_Teensy41 v1.2.1
+ Bump up version to v1.2.1 to sync with ASYNC_UDP_Teensy41 v1.2.1
*****************************************************************************************************************************/
#pragma once
@@ -26,7 +26,7 @@
#if !defined(BOARD_NAME)
#define BOARD_NAME "TEENSY 4.1"
#endif
-
+
// Use true for NativeEthernet Library, false if using other Ethernet libraries
#define USE_NATIVE_ETHERNET false
#define USE_QN_ETHERNET true
diff --git a/src/AsyncUDP_Teensy41_Debug.h b/src/AsyncUDP_Teensy41_Debug.h
index 9c09c79..2a29ae9 100644
--- a/src/AsyncUDP_Teensy41_Debug.h
+++ b/src/AsyncUDP_Teensy41_Debug.h
@@ -1,19 +1,19 @@
/****************************************************************************************************************************
AsyncUDP_Teensy41_Debug.h
-
+
For Teensy41 with QNEthernet
-
+
ASYNC_UDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Teensy41
-
+
Version: 1.2.1
-
+
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.1 K Hoang 18/03/2022 Initial coding for Teensy 4.1 using built-in QNEthernet.
- Bump up version to v1.2.1 to sync with ASYNC_UDP_Teensy41 v1.2.1
+ Bump up version to v1.2.1 to sync with ASYNC_UDP_Teensy41 v1.2.1
*****************************************************************************************************************************/
#pragma once
diff --git a/src/AsyncUDP_Teensy41_Impl.h b/src/AsyncUDP_Teensy41_Impl.h
index e46fe15..33509e0 100644
--- a/src/AsyncUDP_Teensy41_Impl.h
+++ b/src/AsyncUDP_Teensy41_Impl.h
@@ -1,19 +1,19 @@
/****************************************************************************************************************************
AsyncUdp_Impl_Teensy41.h
-
+
For Teensy41 with QNEthernet
-
+
ASYNC_UDP_Teensy41 is a Async UDP library for the Teensy41 using built-in Ethernet and QNEThernet
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Teensy41
-
+
Version: 1.2.1
-
+
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.1 K Hoang 18/03/2022 Initial coding for Teensy 4.1 using built-in QNEthernet.
- Bump up version to v1.2.1 to sync with ASYNC_UDP_Teensy41 v1.2.1
+ Bump up version to v1.2.1 to sync with ASYNC_UDP_Teensy41 v1.2.1
*****************************************************************************************************************************/
#pragma once
@@ -239,9 +239,9 @@ void AsyncUDP::_recv(udp_pcb *upcb, pbuf *pb, ip_addr_t *addr, const uint16_t& p
}
#if LWIP_VERSION_MAJOR == 1
-void AsyncUDP::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, ip_addr_t *addr, uint16_t port)
+ void AsyncUDP::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, ip_addr_t *addr, uint16_t port)
#else
-void AsyncUDP::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port)
+ void AsyncUDP::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port)
#endif
{
reinterpret_cast(arg)->_recv(upcb, p, (ip_addr_t *)addr, port);
diff --git a/utils/astyle_library.conf b/utils/astyle_library.conf
new file mode 100644
index 0000000..8a73bc2
--- /dev/null
+++ b/utils/astyle_library.conf
@@ -0,0 +1,70 @@
+# Code formatting rules for Arduino libraries, modified from for KH libraries:
+#
+# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
+#
+
+# astyle --style=allman -s2 -t2 -C -S -xW -Y -M120 -f -p -xg -H -xb -c --xC120 -xL *.h *.cpp *.ino
+
+--mode=c
+--lineend=linux
+--style=allman
+
+# -r or -R
+#--recursive
+
+# -c => Converts tabs into spaces
+convert-tabs
+
+# -s2 => 2 spaces indentation
+--indent=spaces=2
+
+# -t2 => tab =2 spaces
+#--indent=tab=2
+
+# -C
+--indent-classes
+
+# -S
+--indent-switches
+
+# -xW
+--indent-preproc-block
+
+# -Y => indent classes, switches (and cases), comments starting at column 1
+--indent-col1-comments
+
+# -M120 => maximum of 120 spaces to indent a continuation line
+--max-continuation-indent=120
+
+# -xC120 => max‑code‑length will break a line if the code exceeds # characters
+--max-code-length=120
+
+# -f =>
+--break-blocks
+
+# -p => put a space around operators
+--pad-oper
+
+# -xg => Insert space padding after commas
+--pad-comma
+
+# -H => put a space after if/for/while
+pad-header
+
+# -xb => Break one line headers (e.g. if/for/while)
+--break-one-line-headers
+
+# -c => Converts tabs into spaces
+#--convert-tabs
+
+# if you like one-liners, keep them
+#keep-one-line-statements
+
+# -xV
+--attach-closing-while
+
+#unpad-paren
+
+# -xp
+remove-comment-prefix
+
diff --git a/utils/restyle.sh b/utils/restyle.sh
new file mode 100644
index 0000000..bcd846f
--- /dev/null
+++ b/utils/restyle.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+for dir in . ; do
+ find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.ino" \) -exec astyle --suffix=none --options=./utils/astyle_library.conf \{\} \;
+done
+