Skip to content

Commit 3f0858d

Browse files
committed
fix(modem): Fixup the docs
1 parent 3a2acb4 commit 3f0858d

File tree

9 files changed

+42
-49
lines changed

9 files changed

+42
-49
lines changed

.github/workflows/modem__build-host-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108
steps:
109109
- name: Checkout esp-protocols
110110
uses: actions/checkout@v4
111+
- name: Compat check
111112
shell: bash
112113
run: |
113114
apt-get update -y

components/esp_modem/generate/include/esp_modem_command_declare_helper.inc

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,5 @@
11
#pragma once
2-
//
3-
//#define INT_IN(name) int name
4-
//#ifdef __cplusplus
5-
//#define STRING_IN(name) const std::string& name
6-
//#define STRING_OUT(name) std::string& name
7-
//#define BOOL_IN(name) const bool name
8-
//#define BOOL_OUT(name) bool& name
9-
//#define INT_OUT(name) int& name
10-
//#define INTEGER_LIST_IN(name) const int* name
11-
//#define STRUCT_OUT(struct_name, name) struct_name& name
12-
//#else
13-
//#define STRING_IN(name) const char* name
14-
//#define STRING_OUT(name) char* name
15-
//#define BOOL_IN(name) const bool name
16-
//#define BOOL_OUT(name) bool* name
17-
//#define INT_OUT(name) int* name
18-
//#define INTEGER_LIST_IN(name) const int* name
19-
//#define STRUCT_OUT(struct_name, name) esp_modem_ ## struct_name ## _t* name
20-
//#endif
21-
//
22-
//#define FORWARD_INT_IN(name) name
23-
//#define FORWARD_STRING_IN(name) name
24-
//#define FORWARD_STRING_OUT(name) name
25-
//#define FORWARD_BOOL_IN(name) name
26-
//#define FORWARD_BOOL_OUT(name) name
27-
//#define FORWARD_INT_OUT(name) name
28-
//#define FORWARD_INTEGER_LIST_IN(name) name
29-
//#define FORWARD_STRUCT_OUT(struct_name, name) name
302

31-
// Utility to count arguments (works for up to two parameters here)
323
#define ESP_MODEM_GET_MACRO(_0, _1, _2, _3, _4, _5, _6, ESP_MODEM_MACRO_NAME, ...) ESP_MODEM_MACRO_NAME
334
#define ESP_MODEM_COMMAND_PARAMS(...) ESP_MODEM_GET_MACRO(_0, ##__VA_ARGS__, ESP_MODEM_HELPER6, ESP_MODEM_HELPER5, ESP_MODEM_HELPER4, ESP_MODEM_HELPER3, ESP_MODEM_HELPER2, ESP_MODEM_HELPER1, ESP_MODEM_HELPER0)(PARAM_, ESP_MODEM_NO_COMMA, ESP_MODEM_NO_COMMA, ##__VA_ARGS__)
345
#define ESP_MODEM_COMMAND_PARAMS_AFTER(...) ESP_MODEM_GET_MACRO(_0, ##__VA_ARGS__, ESP_MODEM_HELPER6, ESP_MODEM_HELPER5, ESP_MODEM_HELPER4, ESP_MODEM_HELPER3, ESP_MODEM_HELPER2, ESP_MODEM_HELPER1, ESP_MODEM_HELPER0)(PARAM_, ESP_MODEM_COMMA, ESP_MODEM_NO_COMMA, ##__VA_ARGS__)
@@ -45,14 +16,6 @@
4516
#define PARAM_STRUCT_OUT(struct_name, name) struct_name& name
4617
#define PARAM_INT_LIST_IN(name) const int* name
4718
#else
48-
//#define STRING_IN(name) const char* name
49-
//#define STRING_OUT(name) char* name
50-
//#define BOOL_IN(name) const bool name
51-
//#define BOOL_OUT(name) bool* name
52-
//#define INT_OUT(name) int* name
53-
//#define INTEGER_LIST_IN(name) const int* name
54-
//#define STRUCT_OUT(struct_name, name) esp_modem_ ## struct_name ## _t* name
55-
5619
#define PARAM_STR_OUT(name) char* name
5720
#define PARAM_STR_IN(name) const char* name
5821
#define PARAM_INT_OUT(name) int* name
@@ -61,8 +24,8 @@
6124
#define PARAM_BOOL_OUT(name) bool* name
6225
#define PARAM_STRUCT_OUT(struct_name, name) esp_modem_ ## struct_name ## _t* name
6326
#define PARAM_INT_LIST_IN(name) const int* name
64-
6527
#endif
28+
6629
#define FORWARD_STR_OUT(name) name
6730
#define FORWARD_STR_IN(name) name
6831
#define FORWARD_INT_OUT(name) name

components/esp_modem/scripts/generate.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ for file in "${files[@]}"; do
4040
echo "Processing $in_file"
4141

4242
# Process the header and includes -- just paste the content (without expanding)
43-
sed -n '1,/ESP-MODEM command module starts here/p' "$in_file" > "$out_file"
43+
sed -n '1,/ESP-MODEM command module starts here/{/ESP-MODEM command module starts here/d;p}' "$in_file" > "$out_file"
4444

4545
# Determine whether to use clang or clang++ based on file extension
4646
if [[ $file == *.cpp || $file == *.hpp ]]; then
4747
compiler="clang++ -E -P -CC -xc++"
48+
elif [[ $file == *.rst ]]; then
49+
compiler="clang -E -P -xc"
4850
else
4951
compiler="clang -E -P -CC -xc"
5052
fi

docs/esp_modem/Doxyfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,8 +829,8 @@ INPUT = \
829829
$(PROJECT_PATH)/../components/esp_modem/include/cxx_include/esp_modem_terminal.hpp \
830830
$(PROJECT_PATH)/../components/esp_modem/include/cxx_include/esp_modem_cmux.hpp \
831831
$(PROJECT_PATH)/../components/esp_modem/include/cxx_include/esp_modem_dce.hpp \
832-
$(PROJECT_PATH)/../docs/esp_modem/en/esp_modem_api_commands.h \
833-
$(PROJECT_PATH)/../docs/esp_modem/en/esp_modem_dce.hpp
832+
$(PROJECT_PATH)/../docs/esp_modem/command/dce.h \
833+
$(PROJECT_PATH)/../docs/esp_modem/command/dce.hpp
834834

835835

836836
# The last two are generated

docs/esp_modem/en/cxx_api_docs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Mode switching commands
3333
Modem commands
3434
--------------
3535

36-
.. include:: cxx_api_links.rst
36+
.. include:: ../command/dce.rst
3737

3838
.. _cpp_destroy:
3939

docs/esp_modem/generate/dce.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
// --- ESP-MODEM command module starts here ---
3+
#include "esp_modem_command_declare_helper.inc"
4+
#define ESP_MODEM_DECLARE_DCE_COMMAND(name, return_type, ...) return_type esp_modem_ ## name (ESP_MODEM_COMMAND_PARAMS(__VA_ARGS__));
5+
6+
#include "esp_modem_command_declare.inc"

docs/esp_modem/generate/dce.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
// --- ESP-MODEM command module starts here ---
3+
class esp_modem::DCE : public DCE_T<GenericModule> {
4+
public:
5+
using DCE_T<GenericModule>::DCE_T;
6+
7+
#include "esp_modem_command_declare_helper.inc"
8+
#define ESP_MODEM_DECLARE_DCE_COMMAND(name, return_type, ...) \
9+
return_type name(ESP_MODEM_COMMAND_PARAMS(__VA_ARGS__));
10+
11+
12+
#include "esp_modem_command_declare.inc"
13+
14+
#undef ESP_MODEM_DECLARE_DCE_COMMAND
15+
16+
};

docs/esp_modem/generate/dce.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
// --- ESP-MODEM command module starts here ---
3+
4+
#define ESP_MODEM_DECLARE_DCE_COMMAND(name, return_type, ...) - :cpp:func:`esp_modem::DCE::name`
5+
6+
#include "esp_modem_command_declare.inc"

docs/esp_modem/generate_docs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
# Cleanup the generated html
44
rm -rf html docs
55

6-
# Generate C++ API header of the DCE
7-
cat ../../components/esp_modem/include/generate/esp_modem_command_declare.inc | clang++ -E -P -CC -xc++ -I../../components/esp_modem/include -DGENERATE_DOCS - | sed -n '1,/DCE command documentation/!p' > en/esp_modem_dce.hpp
6+
pushd `pwd`
87

9-
# Generate C API header of the modem_api.h
10-
cat ../../components/esp_modem/include/generate/esp_modem_command_declare.inc | clang -E -P -CC -xc -I../../components/esp_modem/include -DGENERATE_DOCS - | sed -n '1,/DCE command documentation/!p' > en/esp_modem_api_commands.h
8+
cd ../../components/esp_modem/scripts
9+
./generate.sh ../../docs/esp_modem/generate/dce.rst
10+
./generate.sh ../../docs/esp_modem/generate/dce.hpp
11+
./generate.sh ../../docs/esp_modem/generate/dce.h
1112

12-
13-
# RST with links to C++ API
14-
cat ../../components/esp_modem/include/generate/esp_modem_command_declare.inc | clang -E -P -xc -I../../components/esp_modem/include -DGENERATE_DOCS -DGENERATE_RST_LINKS - | sed 's/NL/\n/g' > en/cxx_api_links.rst
13+
popd
1514

1615
build-docs --target esp32 --language en
1716

0 commit comments

Comments
 (0)