Skip to content

Commit 01e8128

Browse files
committed
Add Pico W examples
1 parent a7ce700 commit 01e8128

40 files changed

+2732
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ add_subdirectory(i2c)
4141
add_subdirectory(interp)
4242
add_subdirectory(multicore)
4343
add_subdirectory(picoboard)
44+
add_subdirectory(pico_w)
4445
add_subdirectory(pio)
4546
add_subdirectory(pwm)
4647
add_subdirectory(reset)

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,32 @@ App|Description
108108
[blinky](picoboard/blinky)| Blink "hello, world" in Morse code on Pico's LED
109109
[button](picoboard/button)| Use Pico's BOOTSEL button as a regular button input, by temporarily suspending flash access.
110110

111+
### Pico W Networking
112+
113+
These eaxmples are for the Pico W, and are only available for `PICO_BOARD=pico_w`
114+
115+
App|Description
116+
---|---
117+
[picow_access_point](pico_w/picow_access_point)| Starts a WiFi access point, and fields DHCP requests.
118+
[picow_blink](pico_w/picow_blink)| Blinks the on-board LED (which is connected via the WiFi chip).
119+
[picow_iperf_server](pico_w/picow_iperf)| Runs an "iperf" server for WiFi speed testing.
120+
[picow_ntp_client](pico_w/picow_ntp_client)| Connects to an NTP server to fetch and display the current time.
121+
[picow_tcp_client](pico_w/picow_tcp_client)| A simple TCP client. You can run [python_test_tcp_server.py](pico_w/python_test_tcp/python_test_tcp_server.py) for it to connect to.
122+
[picow_tcp_server](pico_w/picow_tcp_server)| A simple TCP server. You can use [python_test_tcp_client.py](pico_w/python_test_tcp/python_test_tcp_client.py) to connect to it.
123+
[picow_wifi_scan](pico_w/picow_wifi_scan)| Scans for WiFi networks and prints the results.
124+
125+
#### FreeRTOS examples
126+
127+
These are examples of integrating Pico W networking under FreeRTOS, and require you to set the `FREERTOS_KERNEL_PATH`
128+
to point to the FreeRTOS Kernel.
129+
130+
App|Description
131+
---|---
132+
[picow_freertos_iperf_server_nosys](pico_w/freertos/picow_iperf)| Runs an "iperf" server for WiFi speed testing under FreeRTOS in NO_SYS=1 mode. The LED is blinked in another task
133+
[picow_freertos_iperf_server_sys](pico_w/freertos/picow_iperf)| Runs an "iperf" server for WiFi speed testing under FreeRTOS in NO_SYS=0 (i.e. full FreeRTOS integration) mode. The LED is blinked in another task
134+
[picow_freertos_ping_nosys](pico_w/freertos/ping)| Runs the lwip-contrib/apps/ping test app under FreeRTOS in NO_SYS=1 mode.
135+
[picow_freertos_iperf_server_sys](pico_w/freertos/picow_iperf)| Runs the lwip-contrib/apps/ping test app under FreeRTOS in NO_SYS=0 (i.e. full FreeRTOS integration) mode. The test app uses the lwIP \em socket API in this case.
136+
111137
### PIO
112138

113139
App|Description

pico_w/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cmake_minimum_required(VERSION 3.12)
2+
3+
if (PICO_CYW43_SUPPORTED) # set by BOARD=pico-w
4+
if (NOT TARGET pico_cyw43_arch)
5+
message("Skipping Pico W examples as support is not available")
6+
else()
7+
set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples")
8+
set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples")
9+
10+
add_subdirectory(blink)
11+
add_subdirectory(wifi_scan)
12+
add_subdirectory(access_point)
13+
14+
if ("${WIFI_SSID}" STREQUAL "")
15+
message("Skipping some Pico W examples as WIFI_SSID is not defined")
16+
elseif ("${WIFI_PASSWORD}" STREQUAL "")
17+
message("Skipping some Pico W examples as WIFI_PASSWORD is not defined")
18+
else()
19+
add_subdirectory(iperf)
20+
add_subdirectory(ntp_client)
21+
add_subdirectory(tcp_client)
22+
add_subdirectory(tcp_server)
23+
add_subdirectory(freertos)
24+
endif()
25+
endif()
26+
endif()

pico_w/access_point/CMakeLists.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
add_executable(picow_access_point_background
2+
picow_access_point.c
3+
dhcpserver/dhcpserver.c
4+
)
5+
6+
target_include_directories(picow_access_point_background PRIVATE
7+
${CMAKE_CURRENT_LIST_DIR}
8+
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts
9+
${CMAKE_CURRENT_LIST_DIR}/dhcpserver
10+
)
11+
12+
target_link_libraries(picow_access_point_background
13+
pico_cyw43_arch_lwip_threadsafe_background
14+
pico_stdlib
15+
)
16+
17+
pico_add_extra_outputs(picow_access_point_background)
18+
19+
add_executable(picow_access_point_poll
20+
picow_access_point.c
21+
dhcpserver/dhcpserver.c
22+
)
23+
target_include_directories(picow_access_point_poll PRIVATE
24+
${CMAKE_CURRENT_LIST_DIR}
25+
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts
26+
${CMAKE_CURRENT_LIST_DIR}/dhcpserver
27+
)
28+
target_link_libraries(picow_access_point_poll
29+
pico_cyw43_arch_lwip_poll
30+
pico_stdlib
31+
)
32+
pico_add_extra_outputs(picow_access_point_poll)
33+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013-2022 Damien P. George
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)