Skip to content

Commit 489fce1

Browse files
committed
modified picow access point example to use lwip http server
1 parent 4c3a3dc commit 489fce1

File tree

4 files changed

+112
-260
lines changed

4 files changed

+112
-260
lines changed

pico_w/wifi/access_point/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ target_include_directories(picow_access_point_background PRIVATE
99
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts
1010
${CMAKE_CURRENT_LIST_DIR}/dhcpserver
1111
${CMAKE_CURRENT_LIST_DIR}/dnsserver
12+
${PICO_LWIP_CONTRIB_PATH}/apps/httpd
1213
)
1314

1415
target_link_libraries(picow_access_point_background
1516
pico_cyw43_arch_lwip_threadsafe_background
1617
pico_stdlib
18+
pico_lwip_http
19+
ap_content
20+
pico_status_led
1721
)
1822
# You can change the address below to change the address of the access point
1923
pico_configure_ip4_address(picow_access_point_background PRIVATE
@@ -31,13 +35,22 @@ target_include_directories(picow_access_point_poll PRIVATE
3135
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts
3236
${CMAKE_CURRENT_LIST_DIR}/dhcpserver
3337
${CMAKE_CURRENT_LIST_DIR}/dnsserver
38+
${PICO_LWIP_CONTRIB_PATH}/apps/httpd
3439
)
3540
target_link_libraries(picow_access_point_poll
3641
pico_cyw43_arch_lwip_poll
3742
pico_stdlib
43+
pico_lwip_http
44+
ap_content
45+
pico_status_led
3846
)
3947
# You can change the address below to change the address of the access point
4048
pico_configure_ip4_address(picow_access_point_poll PRIVATE
4149
CYW43_DEFAULT_IP_AP_ADDRESS 192.168.4.1
4250
)
4351
pico_add_extra_outputs(picow_access_point_poll)
52+
53+
pico_add_library(ap_content NOFLAG)
54+
pico_set_lwip_httpd_content(ap_content INTERFACE
55+
${CMAKE_CURRENT_LIST_DIR}/content/index.shtml
56+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
<head>
3+
<title>Pico Access Point</title>
4+
</head>
5+
<body>
6+
<h1>Hello from Pico.</h1>
7+
<p>Led is <!--#led--></p>
8+
<p></p>
9+
<form action="/switch.cgi" method="get">
10+
<button name="switch" value="switch">Turn led <!--#not_led--></button>
11+
</form>
12+
</body>
13+
</html>

pico_w/wifi/access_point/lwipopts.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,14 @@
77
// This example uses a common include to avoid repetition
88
#include "lwipopts_examples_common.h"
99

10+
// Enable some httpd features
11+
#define LWIP_HTTPD_CGI 1
12+
#define LWIP_HTTPD_SSI 1
13+
#define LWIP_HTTPD_SSI_MULTIPART 1
14+
#define LWIP_HTTPD_SUPPORT_POST 0
15+
#define LWIP_HTTPD_SSI_INCLUDE_TAG 0
16+
17+
// Generated file containing html data
18+
#define HTTPD_FSDATA_FILE "pico_fsdata.inc"
19+
1020
#endif

0 commit comments

Comments
 (0)