Skip to content

Commit c47adaa

Browse files
committed
Add support for more Pico W examples
1 parent e6c5631 commit c47adaa

File tree

3 files changed

+118
-2
lines changed

3 files changed

+118
-2
lines changed

data/0.17.0/examples.json

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,17 @@
13311331
],
13321332
"supportRiscV": true
13331333
},
1334+
"picow_wifi_scan": {
1335+
"path": "pico_w/wifi/wifi_scan",
1336+
"name": "picow_wifi_scan",
1337+
"libPaths": [],
1338+
"libNames": [],
1339+
"boards": [
1340+
"pico_w",
1341+
"pico2_w"
1342+
],
1343+
"supportRiscV": true
1344+
},
13341345
"picow_blink": {
13351346
"path": "pico_w/wifi/blink",
13361347
"name": "picow_blink",
@@ -1364,6 +1375,61 @@
13641375
],
13651376
"supportRiscV": true
13661377
},
1378+
"picow_ntp_client": {
1379+
"path": "pico_w/wifi/ntp_client",
1380+
"name": "picow_ntp_client",
1381+
"libPaths": [],
1382+
"libNames": [],
1383+
"boards": [
1384+
"pico_w",
1385+
"pico2_w"
1386+
],
1387+
"supportRiscV": true
1388+
},
1389+
"picow_udp_beacon": {
1390+
"path": "pico_w/wifi/udp_beacon",
1391+
"name": "picow_udp_beacon",
1392+
"libPaths": [],
1393+
"libNames": [],
1394+
"boards": [
1395+
"pico_w",
1396+
"pico2_w"
1397+
],
1398+
"supportRiscV": true
1399+
},
1400+
"picow_iperf_server": {
1401+
"path": "pico_w/wifi/iperf",
1402+
"name": "picow_iperf_server",
1403+
"libPaths": [],
1404+
"libNames": [],
1405+
"boards": [
1406+
"pico_w",
1407+
"pico2_w"
1408+
],
1409+
"supportRiscV": true
1410+
},
1411+
"picow_tcpip_server": {
1412+
"path": "pico_w/wifi/tcp_server",
1413+
"name": "picow_tcpip_server",
1414+
"libPaths": [],
1415+
"libNames": [],
1416+
"boards": [
1417+
"pico_w",
1418+
"pico2_w"
1419+
],
1420+
"supportRiscV": true
1421+
},
1422+
"picow_access_point": {
1423+
"path": "pico_w/wifi/access_point",
1424+
"name": "picow_access_point",
1425+
"libPaths": [],
1426+
"libNames": [],
1427+
"boards": [
1428+
"pico_w",
1429+
"pico2_w"
1430+
],
1431+
"supportRiscV": true
1432+
},
13671433
"picow_ble_temp_reader": {
13681434
"path": "pico_w/bt/standalone",
13691435
"name": "picow_ble_temp_reader",
@@ -1386,6 +1452,39 @@
13861452
],
13871453
"supportRiscV": true
13881454
},
1455+
"picow_ble_temp_sensor_with_wifi": {
1456+
"path": "pico_w/bt/standalone",
1457+
"name": "picow_ble_temp_sensor_with_wifi",
1458+
"libPaths": [],
1459+
"libNames": [],
1460+
"boards": [
1461+
"pico_w",
1462+
"pico2_w"
1463+
],
1464+
"supportRiscV": true
1465+
},
1466+
"dvi_out_hstx_encoder": {
1467+
"path": "hstx/dvi_out_hstx_encoder",
1468+
"name": "dvi_out_hstx_encoder",
1469+
"libPaths": [],
1470+
"libNames": [],
1471+
"boards": [
1472+
"pico2",
1473+
"pico2_w"
1474+
],
1475+
"supportRiscV": true
1476+
},
1477+
"hstx_spi_lcd": {
1478+
"path": "hstx/spi_lcd",
1479+
"name": "hstx_spi_lcd",
1480+
"libPaths": [],
1481+
"libNames": [],
1482+
"boards": [
1483+
"pico2",
1484+
"pico2_w"
1485+
],
1486+
"supportRiscV": true
1487+
},
13891488
"hello_sha256": {
13901489
"path": "sha/sha256",
13911490
"name": "hello_sha256",

scripts/genExamples.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
pass
5454
os.system("git -c advice.detachedHead=false clone https://github.com/raspberrypi/pico-examples.git --depth=1 --branch sdk-2.1.0")
5555
os.environ["PICO_SDK_PATH"] = "~/.pico-sdk/sdk/2.1.0"
56+
os.environ["WIFI_SSID"] = "Your Wi-Fi SSID"
57+
os.environ["WIFI_PASSWORD"] = "Your Wi-Fi Password"
5658

5759
for board in boards:
5860
for platform in platforms[board]:
@@ -74,13 +76,17 @@
7476
target = line.strip('.').strip()
7577
if (
7678
"all" in target or
79+
"build_variant" in target or
7780
target == "clean" or
7881
target == "depend" or
7982
target == "edit_cache" or
8083
target == "rebuild_cache" or
81-
target.endswith("_pio_h")
84+
target.endswith("_pio_h") or
85+
target.endswith("_poll")
8286
):
8387
continue
88+
if target.endswith("_background"):
89+
target = target[:-len("_background")]
8490
targets.append(target)
8591

8692
walk_dir = "./pico-examples"
@@ -106,7 +112,10 @@
106112
if "add_executable" in f_content:
107113
exes = []
108114
for target in targets:
109-
if f"example_auto_set_url({target})" in f_content:
115+
if (
116+
f"pico_add_extra_outputs({target})" in f_content or
117+
f"pico_add_extra_outputs({target}_background)" in f_content
118+
):
110119
exes.append(target)
111120
tmp = target_locs.get(target, {
112121
"locs": [],
@@ -161,6 +170,9 @@
161170
'exampleLibs' : v["libs"]
162171
}
163172
GenerateCMake("tmp", params)
173+
if params["wantThreadsafeBackground"] or params["wantPoll"]:
174+
# Write lwipopts for examples
175+
shutil.copy("lwipopts.h", "tmp/")
164176
shutil.copy("pico-examples/pico_sdk_import.cmake", "tmp/")
165177

166178
retcmake = os.system("cmake -S tmp -B tmp-build -DCMAKE_COMPILE_WARNING_AS_ERROR=ON")

scripts/pico_project.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,11 @@ def GenerateCMake(folder, params):
823823
cmake_header2 = cmake_header2.replace(
824824
projectName, newProjectName
825825
)
826+
if "WIFI_SSID" in line and "WIFI_SSID" not in cmake_header2:
827+
cmake_header2 += (
828+
'\nset(WIFI_SSID "Your Wi-Fi SSID")\n'
829+
'set(WIFI_PASSWORD "Your Wi-Fi Password")\n'
830+
)
826831
# Write all headers
827832
file.write(cmake_header1)
828833
file.write(cmake_header_us)

0 commit comments

Comments
 (0)