Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
Update README.md and use allman astyle
Browse files Browse the repository at this point in the history
  • Loading branch information
khoih-prog authored Nov 24, 2022
1 parent 87619ea commit f775e61
Show file tree
Hide file tree
Showing 21 changed files with 245 additions and 113 deletions.
34 changes: 27 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,27 +29,47 @@ 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. ...
2. ...
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
```

8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -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)


<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
<a href="https://profile-counter.glitch.me/khoih-prog/count.svg" title="Total khoih-prog Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog/count.svg" style="height: 30px;width: 200px;"></a>
<a href="https://profile-counter.glitch.me/khoih-prog-AsyncUDP_Teensy41/count.svg" title="AsyncUDP_Teensy41 Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-AsyncUDP_Teensy41/count.svg" style="height: 30px;width: 200px;"></a>

---
---

Expand Down
21 changes: 13 additions & 8 deletions examples/AsyncUDPClient/AsyncUDPClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
*****************************************************************************************************************************/
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions examples/AsyncUDPClient/defines.h
Original file line number Diff line number Diff line change
@@ -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
*****************************************************************************************************************************/
Expand Down
23 changes: 14 additions & 9 deletions examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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?");
}
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions examples/AsyncUDPMulticastServer/defines.h
Original file line number Diff line number Diff line change
@@ -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
*****************************************************************************************************************************/
Expand Down
33 changes: 19 additions & 14 deletions examples/AsyncUDPServer/AsyncUDPServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
*****************************************************************************************************************************/
Expand All @@ -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);

Expand Down Expand Up @@ -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");
Expand All @@ -117,7 +122,7 @@ void setup()
});
}

sendRequest();
sendRequest();

sendUDPRequest.start(); //start the ticker
}
Expand Down
6 changes: 3 additions & 3 deletions examples/AsyncUDPServer/defines.h
Original file line number Diff line number Diff line change
@@ -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
*****************************************************************************************************************************/
Expand Down
Loading

0 comments on commit f775e61

Please sign in to comment.