Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit a87c804

Browse files
authored
Update README.md and use allman astyle
1 parent 2f975ce commit a87c804

File tree

28 files changed

+1381
-1373
lines changed

28 files changed

+1381
-1373
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Arduino IDE version: 1.8.19
3131
`ArduinoCore-mbed` mbed_portenta core v3.4.1
3232
Portenta_H7 Rev2 ABX00042
3333
OS: Ubuntu 20.04 LTS
34-
Linux xy-Inspiron-3593 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
34+
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
3535
3636
Context:
3737
I encountered a crash while using this library

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
# Portenta_H7_AsyncHTTPRequest
1+
# Portenta_H7_AsyncHTTPRequest Library
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/Portenta_H7_AsyncHTTPRequest.svg?)](https://www.ardu-badge.com/Portenta_H7_AsyncHTTPRequest)
44
[![GitHub release](https://img.shields.io/github/release/khoih-prog/Portenta_H7_AsyncHTTPRequest.svg)](https://github.com/khoih-prog/Portenta_H7_AsyncHTTPRequest/releases)
55
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
66
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/Portenta_H7_AsyncHTTPRequest.svg)](http://github.com/khoih-prog/Portenta_H7_AsyncHTTPRequest/issues)
77

8+
89
<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>
910
<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>
10-
<a href="https://profile-counter.glitch.me/khoih-prog-Portenta-H7-AsyncHTTPRequest/count.svg" title="Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-Portenta-H7-AsyncHTTPRequest/count.svg" style="height: 30px;width: 200px;"></a>
11+
<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>
12+
<a href="https://profile-counter.glitch.me/khoih-prog-Portenta_H7_AsyncHTTPRequest/count.svg" title="Portenta_H7_AsyncHTTPRequest Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-Portenta_H7_AsyncHTTPRequest/count.svg" style="height: 30px;width: 200px;"></a>
1113

1214
---
1315
---
@@ -145,9 +147,9 @@ The best and easiest way is to use `Arduino Library Manager`. Search for `Porten
145147
### Manual Install
146148

147149
1. Navigate to [Portenta_H7_AsyncHTTPRequest](https://github.com/khoih-prog/Portenta_H7_AsyncHTTPRequest) page.
148-
2. Download the latest release `Portenta_H7_AsyncHTTPRequest-master.zip`.
149-
3. Extract the zip file to `Portenta_H7_AsyncHTTPRequest-master` directory
150-
4. Copy the whole `Portenta_H7_AsyncHTTPRequest-master` folder to Arduino libraries' directory such as `~/Arduino/libraries/`.
150+
2. Download the latest release `Portenta_H7_AsyncHTTPRequest-main.zip`.
151+
3. Extract the zip file to `Portenta_H7_AsyncHTTPRequest-main` directory
152+
4. Copy the whole `Portenta_H7_AsyncHTTPRequest-main` folder to Arduino libraries' directory such as `~/Arduino/libraries/`.
151153

152154
### VS Code & PlatformIO
153155

@@ -281,7 +283,7 @@ https://github.com/khoih-prog/Portenta_H7_AsyncHTTPRequest/blob/13c9304d5d4fbbfb
281283

282284
#### 1. [AsyncHTTPRequest](examples/WiFi/AsyncHTTPRequest) running on PORTENTA_H7_M7 WiFi
283285

284-
```
286+
```cpp
285287
Start AsyncHTTPRequest on PORTENTA_H7_M7
286288
Portenta_H7_AsyncTCP v1.4.0
287289
Portenta_H7_AsyncHTTPRequest v1.4.2
@@ -329,7 +331,7 @@ week_number: 45
329331

330332
#### 2. [AsyncDweetPOST](examples/WiFi/AsyncDweetPOST) running on PORTENTA_H7_M7 WiFi
331333

332-
```
334+
```cpp
333335
Start AsyncDweetPOST on PORTENTA_H7_M7
334336
Portenta_H7_AsyncTCP v1.4.0
335337
Portenta_H7_AsyncHTTPRequest v1.4.2
@@ -352,7 +354,7 @@ Actual value: 88
352354
353355
#### 3. [AsyncWebClientRepeating](examples/WiFi/AsyncWebClientRepeating) running on PORTENTA_H7_M7 WiFi
354356
355-
```
357+
```cpp
356358
Start AsyncWebClientRepeating on PORTENTA_H7_M7
357359
Portenta_H7_AsyncTCP v1.4.0
358360
Portenta_H7_AsyncHTTPRequest v1.4.2
@@ -410,7 +412,7 @@ signal strength (RSSI):-26 dBm
410412

411413
#### 4. [AsyncCustomHeader](examples/Ethernet/AsyncCustomHeader) running on PORTENTA_H7_M7 Ethernet
412414

413-
```
415+
```cpp
414416
Start AsyncCustomHeader on PORTENTA_H7_M7
415417
Portenta_H7_AsyncTCP v1.4.0
416418
Portenta_H7_AsyncHTTPRequest v1.4.2
@@ -443,7 +445,7 @@ week_number: 45
443445
#### 5. [AsyncWebClientRepeating](examples/Ethernet/AsyncWebClientRepeating) running on PORTENTA_H7_M7 Ethernet
444446

445447

446-
```
448+
```cpp
447449
Start AsyncWebClientRepeating on PORTENTA_H7_M7
448450
Portenta_H7_AsyncTCP v1.4.0
449451
Portenta_H7_AsyncHTTPRequest v1.4.2
@@ -500,7 +502,7 @@ Connected! IP address: 192.168.2.87
500502
#### 6. [AsyncSimpleGET](examples/Ethernet/AsyncSimpleGET) running on PORTENTA_H7_M7 Ethernet
501503

502504

503-
```
505+
```cpp
504506
Start AsyncSimpleGET on PORTENTA_H7_M7
505507
Portenta_H7_AsyncTCP v1.4.0
506508
Portenta_H7_AsyncHTTPRequest v1.4.2
@@ -640,7 +642,7 @@ If you want to contribute to this project:
640642

641643
Copyright (C) <2018> <Bob Lemaire, IoTaWatt, Inc.>
642644

643-
Copyright 2021- Khoi Hoang
645+
Copyright (C) 2021- Khoi Hoang
644646

645647

646648

changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
# Portenta_H7_AsyncHTTPRequest
1+
# Portenta_H7_AsyncHTTPRequest Library
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/Portenta_H7_AsyncHTTPRequest.svg?)](https://www.ardu-badge.com/Portenta_H7_AsyncHTTPRequest)
44
[![GitHub release](https://img.shields.io/github/release/khoih-prog/Portenta_H7_AsyncHTTPRequest.svg)](https://github.com/khoih-prog/Portenta_H7_AsyncHTTPRequest/releases)
55
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
66
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/Portenta_H7_AsyncHTTPRequest.svg)](http://github.com/khoih-prog/Portenta_H7_AsyncHTTPRequest/issues)
77

8+
9+
<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>
10+
<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>
11+
<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>
12+
<a href="https://profile-counter.glitch.me/khoih-prog-Portenta_H7_AsyncHTTPRequest/count.svg" title="Portenta_H7_AsyncHTTPRequest Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-Portenta_H7_AsyncHTTPRequest/count.svg" style="height: 30px;width: 200px;"></a>
13+
814
---
915
---
1016

examples/Ethernet/AsyncCustomHeader/AsyncCustomHeader.ino

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -36,128 +36,128 @@ AsyncHTTPRequest request;
3636

3737
void sendRequest()
3838
{
39-
static bool requestOpenResult;
40-
41-
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
42-
{
43-
Serial.println("\nSending GET Request to " + String(GET_ServerAddress));
44-
45-
requestOpenResult = request.open("GET", GET_ServerAddress);
46-
47-
//request.setReqHeader("X-CUSTOM-HEADER", "custom_value");
48-
if (requestOpenResult)
49-
{
50-
// Only send() if open() returns true, or crash
51-
request.send();
52-
}
53-
else
54-
{
55-
Serial.println("Can't send bad request");
56-
}
57-
}
58-
else
59-
{
60-
Serial.println("Can't send request");
61-
}
39+
static bool requestOpenResult;
40+
41+
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
42+
{
43+
Serial.println("\nSending GET Request to " + String(GET_ServerAddress));
44+
45+
requestOpenResult = request.open("GET", GET_ServerAddress);
46+
47+
//request.setReqHeader("X-CUSTOM-HEADER", "custom_value");
48+
if (requestOpenResult)
49+
{
50+
// Only send() if open() returns true, or crash
51+
request.send();
52+
}
53+
else
54+
{
55+
Serial.println("Can't send bad request");
56+
}
57+
}
58+
else
59+
{
60+
Serial.println("Can't send request");
61+
}
6262
}
6363

6464
void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState)
6565
{
66-
(void) optParm;
67-
68-
if (readyState == readyStateDone)
69-
{
70-
AHTTP_LOGWARN(F("\n**************************************"));
71-
AHTTP_LOGWARN1(F("Response Code = "), request->responseHTTPString());
72-
73-
if (request->responseHTTPcode() == 200)
74-
{
75-
Serial.println(F("\n**************************************"));
76-
Serial.println(request->responseText());
77-
Serial.println(F("**************************************"));
78-
}
79-
}
66+
(void) optParm;
67+
68+
if (readyState == readyStateDone)
69+
{
70+
AHTTP_LOGWARN(F("\n**************************************"));
71+
AHTTP_LOGWARN1(F("Response Code = "), request->responseHTTPString());
72+
73+
if (request->responseHTTPcode() == 200)
74+
{
75+
Serial.println(F("\n**************************************"));
76+
Serial.println(request->responseText());
77+
Serial.println(F("**************************************"));
78+
}
79+
}
8080
}
8181

8282
void setup()
8383
{
84-
Serial.begin(115200);
84+
Serial.begin(115200);
8585

86-
while (!Serial && millis() < 5000);
86+
while (!Serial && millis() < 5000);
8787

88-
Serial.print("\nStart AsyncCustomHeader on ");
89-
Serial.println(BOARD_NAME);
90-
Serial.println(PORTENTA_H7_ASYNC_TCP_VERSION);
91-
Serial.println(PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION);
88+
Serial.print("\nStart AsyncCustomHeader on ");
89+
Serial.println(BOARD_NAME);
90+
Serial.println(PORTENTA_H7_ASYNC_TCP_VERSION);
91+
Serial.println(PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION);
9292

9393
#if defined(PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN)
9494

95-
if (PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_INT < PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN)
96-
{
97-
Serial.print("Warning. Must use this example on Version equal or later than : ");
98-
Serial.println(PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET);
99-
}
95+
if (PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_INT < PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN)
96+
{
97+
Serial.print("Warning. Must use this example on Version equal or later than : ");
98+
Serial.println(PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET);
99+
}
100100

101101
#endif
102102

103-
///////////////////////////////////
103+
///////////////////////////////////
104104

105-
// start the ethernet connection and the server
106-
// Use random mac
107-
uint16_t index = millis() % NUMBER_OF_MAC;
105+
// start the ethernet connection and the server
106+
// Use random mac
107+
uint16_t index = millis() % NUMBER_OF_MAC;
108108

109-
// Use Static IP
110-
//Ethernet.begin(mac[index], ip);
111-
// Use DHCP dynamic IP and random mac
112-
Ethernet.begin(mac[index]);
109+
// Use Static IP
110+
//Ethernet.begin(mac[index], ip);
111+
// Use DHCP dynamic IP and random mac
112+
Ethernet.begin(mac[index]);
113113

114-
if (Ethernet.hardwareStatus() == EthernetNoHardware)
115-
{
116-
Serial.println("No Ethernet found. Stay here forever");
114+
if (Ethernet.hardwareStatus() == EthernetNoHardware)
115+
{
116+
Serial.println("No Ethernet found. Stay here forever");
117117

118-
while (true)
119-
{
120-
delay(1); // do nothing, no point running without Ethernet hardware
121-
}
122-
}
118+
while (true)
119+
{
120+
delay(1); // do nothing, no point running without Ethernet hardware
121+
}
122+
}
123123

124-
if (Ethernet.linkStatus() == LinkOFF)
125-
{
126-
Serial.println("Not connected Ethernet cable");
127-
}
124+
if (Ethernet.linkStatus() == LinkOFF)
125+
{
126+
Serial.println("Not connected Ethernet cable");
127+
}
128128

129-
Serial.print(F("Using mac index = "));
130-
Serial.println(index);
129+
Serial.print(F("Using mac index = "));
130+
Serial.println(index);
131131

132-
Serial.print(F("Connected! IP address: "));
133-
Serial.println(Ethernet.localIP());
132+
Serial.print(F("Connected! IP address: "));
133+
Serial.println(Ethernet.localIP());
134134

135-
///////////////////////////////////
135+
///////////////////////////////////
136136

137-
request.setDebug(false);
137+
request.setDebug(false);
138138

139-
// 5s timeout
140-
request.setTimeout(5);
139+
// 5s timeout
140+
request.setTimeout(5);
141141

142-
request.onReadyStateChange(requestCB);
142+
request.onReadyStateChange(requestCB);
143143
}
144144

145145
void sendRequestRepeat()
146146
{
147-
static unsigned long sendRequest_timeout = 0;
147+
static unsigned long sendRequest_timeout = 0;
148148

149149
#define SEND_REQUEST_INTERVAL 60000L
150150

151-
// sendRequest every SEND_REQUEST_INTERVAL (60) seconds: we don't need to sendRequest frequently
152-
if ((millis() > sendRequest_timeout) || (sendRequest_timeout == 0))
153-
{
154-
sendRequest();
151+
// sendRequest every SEND_REQUEST_INTERVAL (60) seconds: we don't need to sendRequest frequently
152+
if ((millis() > sendRequest_timeout) || (sendRequest_timeout == 0))
153+
{
154+
sendRequest();
155155

156-
sendRequest_timeout = millis() + SEND_REQUEST_INTERVAL;
157-
}
156+
sendRequest_timeout = millis() + SEND_REQUEST_INTERVAL;
157+
}
158158
}
159159

160160
void loop()
161161
{
162-
sendRequestRepeat();
162+
sendRequestRepeat();
163163
}

examples/Ethernet/AsyncCustomHeader/defines.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#define defines_h
2525

2626
#if !( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) )
27-
#error For Portenta_H7 only
27+
#error For Portenta_H7 only
2828
#endif
2929

3030
#define PORTENTA_H7_ASYNC_HTTP_DEBUG_PORT Serial
@@ -43,26 +43,26 @@
4343

4444
byte mac[][NUMBER_OF_MAC] =
4545
{
46-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 },
47-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 },
48-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 },
49-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 },
50-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 },
51-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 },
52-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 },
53-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 },
54-
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 },
55-
{ 0xDE, 0xAD, 0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0xBE, 0xEF, 0x32, 0x0F },
61+
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 },
62+
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 },
63+
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 },
64+
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 },
65+
{ 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 },
6666
};
6767

6868
#endif //defines_h

0 commit comments

Comments
 (0)