Skip to content

Commit 1721f9d

Browse files
Add some docs for pico_set_lwip_httpd_content (#2411)
1 parent f674850 commit 1721f9d

File tree

1 file changed

+44
-0
lines changed
  • src/rp2_common/pico_lwip

1 file changed

+44
-0
lines changed

src/rp2_common/pico_lwip/doc.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,47 @@
4444
* \ingroup pico_lwip
4545
* \brief lwIP compiler adapters. This is not included by default in \c \b pico_lwip in case you wish to implement your own.
4646
*/
47+
48+
/** \defgroup pico_lwip_http pico_lwip_http
49+
* \ingroup pico_lwip
50+
* \brief LwIP HTTP client and server library
51+
*
52+
* This library enables you to make use of the LwIP HTTP client and server library
53+
*
54+
* \par LwIP HTTP server
55+
*
56+
* To make use of the LwIP HTTP server you need to provide the HTML that the server will return to the client.
57+
* This is done by compiling the content directly into the executable.
58+
*
59+
* \par makefsdata
60+
*
61+
* LwIP provides a c-library tool `makefsdata` to compile your HTML into a source file for inclusion into your program.
62+
* This is quite hard to use as you need to compile the tool as a native binary, then run the tool to generate a source file
63+
* before compiling your code for the Pico device.
64+
*
65+
* \par pico_set_lwip_httpd_content
66+
*
67+
* To make this whole process easier, a python script `makefsdata.py` is provided to generate a source file for your HTML content.
68+
* A CMake function `pico_set_lwip_httpd_content` takes care of running the `makefsdata.py` python script for you.
69+
* To make use of this, specify the name of the source file as `pico_fsdata.inc` in `lwipopts.h`.
70+
*
71+
* \code
72+
* #define HTTPD_FSDATA_FILE "pico_fsdata.inc"
73+
* \endcode
74+
*
75+
* Then call the CMake function `pico_set_lwip_httpd_content` in your `CMakeLists.txt` to add your content to a library.
76+
* Make sure you add this library to your executable by adding it to your target_link_libraries list.
77+
* Here is an example from the httpd example in pico-examples.
78+
*
79+
* \code
80+
* pico_add_library(pico_httpd_content NOFLAG)
81+
* pico_set_lwip_httpd_content(pico_httpd_content INTERFACE
82+
* ${CMAKE_CURRENT_LIST_DIR}/content/404.html
83+
* ${CMAKE_CURRENT_LIST_DIR}/content/index.shtml
84+
* ${CMAKE_CURRENT_LIST_DIR}/content/test.shtml
85+
* ${CMAKE_CURRENT_LIST_DIR}/content/ledpass.shtml
86+
* ${CMAKE_CURRENT_LIST_DIR}/content/ledfail.shtml
87+
* ${CMAKE_CURRENT_LIST_DIR}/content/img/rpi.png
88+
* )
89+
* \endcode
90+
*/

0 commit comments

Comments
 (0)