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

Commit 4ba83df

Browse files
authored
v1.0.3 to display / change country-code
### Release v1.0.3 1. Modify examples to display `country-code` 2. Add tempo method to modify `arduino-pico` core to change `country-code` 3. Add example [Async_AdvancedWebServer_Country](https://github.com/khoih-prog/AsyncWebServer_RP2040W/tree/main/examples/Async_AdvancedWebServer_Country)
1 parent 6b5e04c commit 4ba83df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+309
-38
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1515
Please ensure to specify the following:
1616

1717
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18-
* `RP2040` Core Version (e.g. RP2040 core v2.5.2)
18+
* `RP2040` Core Version (e.g. RP2040 core v2.5.4)
1919
* `RP2040W` Board type (e.g. RASPBERRY_PI_PICO_W)
2020
* Contextual information (e.g. what you were trying to achieve)
2121
* Simplest possible steps to reproduce
@@ -28,7 +28,7 @@ Please ensure to specify the following:
2828

2929
```
3030
Arduino IDE version: 1.8.19
31-
RP2040 core v2.5.2
31+
RP2040 core v2.5.4
3232
RASPBERRY_PI_PICO_W Module
3333
OS: Ubuntu 20.04 LTS
3434
Linux xy-Inspiron-3593 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

README.md

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
* [ 8. **MQTT_ThingStream**](examples/MQTT_ThingStream)
8787
* [ 9. WebClient](examples/WebClient)
8888
* [10. WebClientRepeating](examples/WebClientRepeating)
89+
* [11. Async_AdvancedWebServer_Country](examples/Async_AdvancedWebServer_Country) **New**
8990
* [Example Async_AdvancedWebServer](#Example-Async_AdvancedWebServer)
9091
* [Debug Terminal Output Samples](#debug-terminal-output-samples)
9192
* [1. Async_AdvancedWebServer on RASPBERRY_PI_PICO_W using CYW43439 WiFi](#1-Async_AdvancedWebServer-on-RASPBERRY_PI_PICO_W-using-CYW43439-WiFi)
@@ -149,8 +150,8 @@ to apply the better and faster **asynchronous** feature of the **powerful** [ESP
149150
## Prerequisites
150151

151152
1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [![GitHub release](https://img.shields.io/github/release/arduino/Arduino.svg)](https://github.com/arduino/Arduino/releases/latest)
152-
2. [`Earle Philhower's arduino-pico core v2.5.2+`](https://github.com/earlephilhower/arduino-pico) for **RASPBERRY_PI_PICO_W with CYW43439 WiFi**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest)
153-
3. [`AsyncTCP_RP2040W library v1.0.0+`](https://github.com/khoih-prog/AsyncTCP_RP2040W) for RASPBERRY_PI_PICO_W with CYW43439 WiFi. To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/AsyncTCP_RP2040W.svg?)](https://www.ardu-badge.com/AsyncTCP_RP2040W)
153+
2. [`Earle Philhower's arduino-pico core v2.5.4+`](https://github.com/earlephilhower/arduino-pico) for **RASPBERRY_PI_PICO_W with CYW43439 WiFi**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest)
154+
3. [`AsyncTCP_RP2040W library v1.0.0+`](https://github.com/khoih-prog/AsyncTCP_RP2040W) for RASPBERRY_PI_PICO_W with CYW43439 WiFi. [![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncTCP_RP2040W.svg)](https://github.com/khoih-prog/AsyncTCP_RP2040W/releases/latest). To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/AsyncTCP_RP2040W.svg?)](https://www.ardu-badge.com/AsyncTCP_RP2040W)
154155

155156
---
156157

@@ -1421,6 +1422,7 @@ build_flags =
14211422
8. [**MQTT_ThingStream**](examples/MQTT_ThingStream)
14221423
9. [WebClient](examples/WebClient)
14231424
10. [WebClientRepeating](examples/WebClientRepeating)
1425+
11. [Async_AdvancedWebServer_Country](examples/Async_AdvancedWebServer_Country) **New**
14241426

14251427

14261428
---
@@ -1449,10 +1451,11 @@ Following is the debug terminal when running example [Async_AdvancedWebServer](e
14491451
```
14501452
Start Async_AdvancedWebServer on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
14511453
AsyncTCP_RP2040W v1.0.0
1452-
AsyncWebServer_RP2040W v1.0.2
1454+
AsyncWebServer_RP2040W v1.0.3
14531455
Connecting to SSID: HueNet1
14541456
SSID: HueNet1
14551457
Local IP Address: 192.168.2.180
1458+
Country code: CA <================ Country code CA for CYW43_COUNTRY_CANADA
14561459
HTTP EthernetWebServer is @ IP : 192.168.2.180
14571460
.......... .......... .......... .......... .......... .......... .......... ..........
14581461
.......... .......... .......... .......... .......... ...
@@ -1472,10 +1475,11 @@ Following is debug terminal output when running example [WebClient](examples/Web
14721475
```
14731476
Start WebClient on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
14741477
AsyncTCP_RP2040W v1.0.0
1475-
AsyncWebServer_RP2040W v1.0.2
1478+
AsyncWebServer_RP2040W v1.0.3
14761479
Connecting to SSID: HueNet1
14771480
SSID: HueNet1
14781481
Local IP Address: 192.168.2.180
1482+
Country code: CA <================ Country code CA for CYW43_COUNTRY_CANADA
14791483
14801484
Starting connection to server...
14811485
Connected to server
@@ -1549,10 +1553,11 @@ Following is debug terminal output when running example [MQTTClient_Auth](exampl
15491553
```
15501554
Start MQTTClient_Auth on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
15511555
AsyncTCP_RP2040W v1.0.0
1552-
AsyncWebServer_RP2040W v1.0.2
1556+
AsyncWebServer_RP2040W v1.0.3
15531557
Connecting to SSID: HueNet1
15541558
SSID: HueNet1
15551559
Local IP Address: 192.168.2.180
1560+
Country code: CA <================ Country code CA for CYW43_COUNTRY_CANADA
15561561
Attempting MQTT connection to broker.emqx.io...connected
15571562
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
15581563
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
@@ -1570,10 +1575,11 @@ Following is debug terminal output when running example [MQTTClient_Basic](examp
15701575
```
15711576
Start MQTTClient_Basic on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
15721577
AsyncTCP_RP2040W v1.0.0
1573-
AsyncWebServer_RP2040W v1.0.2
1578+
AsyncWebServer_RP2040W v1.0.3
15741579
Connecting to SSID: HueNet1
15751580
SSID: HueNet1
15761581
Local IP Address: 192.168.2.180
1582+
Country code: CA <================ Country code CA for CYW43_COUNTRY_CANADA
15771583
Attempting MQTT connection to broker.emqx.io...connected
15781584
Message Send : MQTT_Pub => Hello from MQTTClient_Basic on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
15791585
Message arrived [MQTT_Pub] Hello from MQTTClient_Basic on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
@@ -1591,10 +1597,11 @@ Following is debug terminal output when running example [MQTT_ThingStream](examp
15911597
```
15921598
Start MQTT_ThingStream on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
15931599
AsyncTCP_RP2040W v1.0.0
1594-
AsyncWebServer_RP2040W v1.0.2
1600+
AsyncWebServer_RP2040W v1.0.3
15951601
Connecting to SSID: HueNet1
15961602
SSID: HueNet1
15971603
Local IP Address: 192.168.2.180
1604+
Country code: CA <================ Country code CA for CYW43_COUNTRY_CANADA
15981605
***************************************
15991606
RP2040W_Pub
16001607
***************************************
@@ -1608,6 +1615,29 @@ MQTT Message Send : RP2040W_Pub => Hello from MQTT_ThingStream on RASPBERRY_PI_P
16081615
MQTT Message receive [RP2040W_Pub] Hello from MQTT_ThingStream on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
16091616
```
16101617

1618+
#### 6. Async_AdvancedWebServer_Country on RASPBERRY_PI_PICO_W using CYW43439 WiFi
1619+
1620+
Following is the debug terminal when running example [Async_AdvancedWebServer_Country](examples/Async_AdvancedWebServer_Country) on RASPBERRY_PI_PICO_W using CYW43439 WiFi to demonstrate the operation of AsyncWebServer_RP2040W, based on this [AsyncTCP_RP2040W Library](https://github.com/khoih-prog/AsyncTCP_RP2040W) and to display programmed country-code
1621+
1622+
1623+
```
1624+
Start Async_AdvancedWebServer_Country on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
1625+
AsyncTCP_RP2040W v1.0.0
1626+
AsyncWebServer_RP2040W v1.0.3
1627+
Connecting to SSID: HueNet1
1628+
SSID: HueNet1
1629+
Local IP Address: 192.168.2.180
1630+
Country code: CA <================ Country code CA for CYW43_COUNTRY_CANADA
1631+
HTTP EthernetWebServer is @ IP : 192.168.2.180
1632+
....
1633+
```
1634+
1635+
<p align="center">
1636+
<img src="https://github.com/khoih-prog/AsyncWebServer_RP2040W/blob/main/pics/Async_AdvancedWebServer_Country.png">
1637+
</p>
1638+
1639+
---
1640+
16111641
---
16121642
---
16131643

@@ -1646,6 +1676,8 @@ Submit issues to: [AsyncWebServer_RP2040W issues](https://github.com/khoih-prog/
16461676

16471677
1. Add support to RASPBERRY_PI_PICO_W using CYW43439 WiFi
16481678
2. Add Table of Contents
1679+
3. Modify examples to display `country-code`
1680+
4. Add tempo method to modify `arduino-pico` core to change `country-code`
16491681

16501682
---
16511683
---

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
## Table of Contents
1212

1313
* [Changelog](#changelog)
14+
* [Release v1.0.3](#Release-v103)
1415
* [Release v1.0.2](#Release-v102)
1516
* [Release v1.0.1](#Release-v101)
1617
* [Initial Release v1.0.0](#Initial-Release-v100)
@@ -20,6 +21,12 @@
2021

2122
## Changelog
2223

24+
### Release v1.0.3
25+
26+
1. Modify examples to display `country-code`
27+
2. Add tempo method to modify `arduino-pico` core to change `country-code`
28+
3. Add example [Async_AdvancedWebServer_Country](https://github.com/khoih-prog/AsyncWebServer_RP2040W/tree/main/examples/Async_AdvancedWebServer_Country)
29+
2330
### Release v1.0.2
2431

2532
1. Fix LED bug in examples

examples/Async_AdvancedWebServer/Async_AdvancedWebServer.ino

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,23 @@
3838
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3939
*****************************************************************************************************************************/
4040

41+
// See the list of country codes in
42+
// https://github.com/earlephilhower/cyw43-driver/blob/02533c10a018c6550e9f66f7699e21356f5e4609/src/cyw43_country.h#L59-L111
43+
// To modify https://github.com/earlephilhower/arduino-pico/blob/master/variants/rpipicow/picow_init.cpp
44+
// Check https://github.com/khoih-prog/AsyncWebServer_RP2040W/issues/3#issuecomment-1255676644
45+
4146
#if !( defined(ARDUINO_RASPBERRY_PI_PICO_W) )
4247
#error For RASPBERRY_PI_PICO_W only
4348
#endif
4449

4550
#define _RP2040W_AWS_LOGLEVEL_ 1
4651

52+
///////////////////////////////////////////////////////////////////
53+
54+
#include <pico/cyw43_arch.h>
55+
56+
///////////////////////////////////////////////////////////////////
57+
4758
#include <AsyncWebServer_RP2040W.h>
4859

4960
char ssid[] = "your_ssid"; // your network SSID (name)
@@ -152,6 +163,16 @@ void printWifiStatus()
152163
IPAddress ip = WiFi.localIP();
153164
Serial.print("Local IP Address: ");
154165
Serial.println(ip);
166+
167+
// print your board's country code
168+
// #define CYW43_COUNTRY(A, B, REV) ((unsigned char)(A) | ((unsigned char)(B) << 8) | ((REV) << 16))
169+
uint32_t myCountryCode = cyw43_arch_get_country_code();
170+
char countryCode[3] = { 0, 0, 0 };
171+
172+
countryCode[0] = myCountryCode & 0xFF;
173+
countryCode[1] = (myCountryCode >> 8) & 0xFF;
174+
175+
Serial.print("Country code: "); Serial.println(countryCode);
155176
}
156177

157178
void setup()
@@ -181,7 +202,7 @@ void setup()
181202

182203
Serial.print(F("Connecting to SSID: "));
183204
Serial.println(ssid);
184-
205+
185206
status = WiFi.begin(ssid, pass);
186207

187208
delay(1000);

examples/Async_HelloServer/Async_HelloServer.ino

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,23 @@
1010
Licensed under GPLv3 license
1111
*****************************************************************************************************************************/
1212

13+
// See the list of country codes in
14+
// https://github.com/earlephilhower/cyw43-driver/blob/02533c10a018c6550e9f66f7699e21356f5e4609/src/cyw43_country.h#L59-L111
15+
// To modify https://github.com/earlephilhower/arduino-pico/blob/master/variants/rpipicow/picow_init.cpp
16+
// Check https://github.com/khoih-prog/AsyncWebServer_RP2040W/issues/3#issuecomment-1255676644
17+
1318
#if !( defined(ARDUINO_RASPBERRY_PI_PICO_W) )
1419
#error For RASPBERRY_PI_PICO_W only
1520
#endif
1621

22+
#define _RP2040W_AWS_LOGLEVEL_ 1
23+
24+
///////////////////////////////////////////////////////////////////
25+
26+
#include <pico/cyw43_arch.h>
27+
28+
///////////////////////////////////////////////////////////////////
29+
1730
#include <AsyncWebServer_RP2040W.h>
1831

1932
char ssid[] = "your_ssid"; // your network SSID (name)
@@ -74,6 +87,16 @@ void printWifiStatus()
7487
IPAddress ip = WiFi.localIP();
7588
Serial.print("Local IP Address: ");
7689
Serial.println(ip);
90+
91+
// print your board's country code
92+
// #define CYW43_COUNTRY(A, B, REV) ((unsigned char)(A) | ((unsigned char)(B) << 8) | ((REV) << 16))
93+
uint32_t myCountryCode = cyw43_arch_get_country_code();
94+
char countryCode[3] = { 0, 0, 0 };
95+
96+
countryCode[0] = myCountryCode & 0xFF;
97+
countryCode[1] = (myCountryCode >> 8) & 0xFF;
98+
99+
Serial.print("Country code: "); Serial.println(countryCode);
77100
}
78101

79102
void setup()

examples/Async_HelloServer2/Async_HelloServer2.ino

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,23 @@
1010
Licensed under GPLv3 license
1111
*****************************************************************************************************************************/
1212

13+
// See the list of country codes in
14+
// https://github.com/earlephilhower/cyw43-driver/blob/02533c10a018c6550e9f66f7699e21356f5e4609/src/cyw43_country.h#L59-L111
15+
// To modify https://github.com/earlephilhower/arduino-pico/blob/master/variants/rpipicow/picow_init.cpp
16+
// Check https://github.com/khoih-prog/AsyncWebServer_RP2040W/issues/3#issuecomment-1255676644
17+
1318
#if !( defined(ARDUINO_RASPBERRY_PI_PICO_W) )
1419
#error For RASPBERRY_PI_PICO_W only
1520
#endif
1621

1722
#define _RP2040W_AWS_LOGLEVEL_ 1
1823

24+
///////////////////////////////////////////////////////////////////
25+
26+
#include <pico/cyw43_arch.h>
27+
28+
///////////////////////////////////////////////////////////////////
29+
1930
#include <WiFi.h>
2031

2132
#include <AsyncWebServer_RP2040W.h>
@@ -76,6 +87,16 @@ void printWifiStatus()
7687
IPAddress ip = WiFi.localIP();
7788
Serial.print("Local IP Address: ");
7889
Serial.println(ip);
90+
91+
// print your board's country code
92+
// #define CYW43_COUNTRY(A, B, REV) ((unsigned char)(A) | ((unsigned char)(B) << 8) | ((REV) << 16))
93+
uint32_t myCountryCode = cyw43_arch_get_country_code();
94+
char countryCode[3] = { 0, 0, 0 };
95+
96+
countryCode[0] = myCountryCode & 0xFF;
97+
countryCode[1] = (myCountryCode >> 8) & 0xFF;
98+
99+
Serial.print("Country code: "); Serial.println(countryCode);
79100
}
80101

81102
void setup()

examples/Async_HttpBasicAuth/Async_HttpBasicAuth.ino

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,23 @@
1010
Licensed under GPLv3 license
1111
*****************************************************************************************************************************/
1212

13+
// See the list of country codes in
14+
// https://github.com/earlephilhower/cyw43-driver/blob/02533c10a018c6550e9f66f7699e21356f5e4609/src/cyw43_country.h#L59-L111
15+
// To modify https://github.com/earlephilhower/arduino-pico/blob/master/variants/rpipicow/picow_init.cpp
16+
// Check https://github.com/khoih-prog/AsyncWebServer_RP2040W/issues/3#issuecomment-1255676644
17+
1318
#if !( defined(ARDUINO_RASPBERRY_PI_PICO_W) )
1419
#error For RASPBERRY_PI_PICO_W only
1520
#endif
1621

1722
#define _RP2040W_AWS_LOGLEVEL_ 1
1823

24+
///////////////////////////////////////////////////////////////////
25+
26+
#include <pico/cyw43_arch.h>
27+
28+
///////////////////////////////////////////////////////////////////
29+
1930
#include <AsyncWebServer_RP2040W.h>
2031

2132
char ssid[] = "your_ssid"; // your network SSID (name)
@@ -38,6 +49,16 @@ void printWifiStatus()
3849
IPAddress ip = WiFi.localIP();
3950
Serial.print("Local IP Address: ");
4051
Serial.println(ip);
52+
53+
// print your board's country code
54+
// #define CYW43_COUNTRY(A, B, REV) ((unsigned char)(A) | ((unsigned char)(B) << 8) | ((REV) << 16))
55+
uint32_t myCountryCode = cyw43_arch_get_country_code();
56+
char countryCode[3] = { 0, 0, 0 };
57+
58+
countryCode[0] = myCountryCode & 0xFF;
59+
countryCode[1] = (myCountryCode >> 8) & 0xFF;
60+
61+
Serial.print("Country code: "); Serial.println(countryCode);
4162
}
4263

4364
void setup()

examples/Async_PostServer/Async_PostServer.ino

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,23 @@
1010
Licensed under GPLv3 license
1111
*****************************************************************************************************************************/
1212

13+
// See the list of country codes in
14+
// https://github.com/earlephilhower/cyw43-driver/blob/02533c10a018c6550e9f66f7699e21356f5e4609/src/cyw43_country.h#L59-L111
15+
// To modify https://github.com/earlephilhower/arduino-pico/blob/master/variants/rpipicow/picow_init.cpp
16+
// Check https://github.com/khoih-prog/AsyncWebServer_RP2040W/issues/3#issuecomment-1255676644
17+
1318
#if !( defined(ARDUINO_RASPBERRY_PI_PICO_W) )
1419
#error For RASPBERRY_PI_PICO_W only
1520
#endif
1621

1722
#define _RP2040W_AWS_LOGLEVEL_ 1
1823

24+
///////////////////////////////////////////////////////////////////
25+
26+
#include <pico/cyw43_arch.h>
27+
28+
///////////////////////////////////////////////////////////////////
29+
1930
#include <AsyncWebServer_RP2040W.h>
2031

2132
char ssid[] = "your_ssid"; // your network SSID (name)
@@ -108,6 +119,16 @@ void printWifiStatus()
108119
IPAddress ip = WiFi.localIP();
109120
Serial.print("Local IP Address: ");
110121
Serial.println(ip);
122+
123+
// print your board's country code
124+
// #define CYW43_COUNTRY(A, B, REV) ((unsigned char)(A) | ((unsigned char)(B) << 8) | ((REV) << 16))
125+
uint32_t myCountryCode = cyw43_arch_get_country_code();
126+
char countryCode[3] = { 0, 0, 0 };
127+
128+
countryCode[0] = myCountryCode & 0xFF;
129+
countryCode[1] = (myCountryCode >> 8) & 0xFF;
130+
131+
Serial.print("Country code: "); Serial.println(countryCode);
111132
}
112133

113134
void setup()

0 commit comments

Comments
 (0)