Skip to content

Commit 77003a1

Browse files
committed
docs: Add COMX LTE Module documents.
Signed-off-by: lbuque <[email protected]>
1 parent 7da85e2 commit 77003a1

File tree

12 files changed

+917
-5
lines changed

12 files changed

+917
-5
lines changed

docs/en/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"machine",
5151
"M5",
5252
"module.mbus",
53+
"network",
5354
]
5455

5556
autodoc_default_options = {

docs/en/module/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Module
2121
lora.rst
2222
lora_sx1262.rst
2323
lorawan868.rst
24+
lte.rst
2425
nbiot.rst
2526
odrive.rst
2627
plus.rst

docs/en/module/lte.rst

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
COMX LTE Module
2+
===============
3+
4+
.. sku: M031-A
5+
6+
.. include:: ../refs/module.lte.ref
7+
8+
LTEModule Class provides a set of methods to control the LTE module. Through the
9+
chat script of AT commands, the module is set to PPP mode and then the data is
10+
sent to the Internet through the serial port.
11+
12+
Support the following products:
13+
14+
|COMX LTE|
15+
16+
17+
UiFlow2 Example
18+
---------------
19+
20+
HTTP GET over LTE
21+
^^^^^^^^^^^^^^^^^
22+
23+
Open the |core2_lte_http_example.m5f2| project in UiFlow2.
24+
25+
This example demonstrates how to use PPP dial-up on the LTE module and then use
26+
the `requests2` library to send an HTTP GET request.
27+
28+
UiFlow2 Code Block:
29+
30+
|example_http.png|
31+
32+
Example output:
33+
34+
None
35+
36+
37+
Chat script
38+
^^^^^^^^^^^
39+
40+
Open the |core2_lte_chat_example.m5f2| project in UiFlow2.
41+
42+
Set the LTE module to PPP mode through a custom AT command chat script.
43+
44+
UiFlow2 Code Block:
45+
46+
|example_chat.png|
47+
48+
Example output:
49+
50+
None
51+
52+
MicroPython Example
53+
-------------------
54+
55+
HTTP GET over LTE
56+
^^^^^^^^^^^^^^^^^
57+
58+
This example demonstrates how to use PPP dial-up on the LTE module and then use
59+
the `requests2` library to send an HTTP GET request.
60+
61+
MicroPython Code Block:
62+
63+
.. literalinclude:: ../../../examples/module/lte/core2_lte_http_example.py
64+
:language: python
65+
:linenos:
66+
67+
Example output:
68+
69+
None
70+
71+
Chat script
72+
^^^^^^^^^^^
73+
74+
Set the LTE module to PPP mode through a custom AT command chat script.
75+
76+
MicroPython Code Block:
77+
78+
.. literalinclude:: ../../../examples/module/lte/core2_lte_chat_example.py
79+
:language: python
80+
:linenos:
81+
82+
Example output:
83+
84+
None
85+
86+
**API**
87+
-------
88+
89+
LTEModule
90+
^^^^^^^^^
91+
92+
.. autoclass:: module.lte.LTEModule
93+
:members:
94+
95+
.. py:method:: active([is_active])
96+
97+
Activate (“up”) or deactivate (“down”) the network interface, if a
98+
boolean argument is passed. Otherwise, query current state if no
99+
argument is provided.
100+
101+
:param bool is_active: If True, the LTE module is enabled, if False, the LTE module is disabled.
102+
103+
:return: Returns the activation status of the LTE module.
104+
:rtype: bool
105+
106+
UiFlow2 Code Block:
107+
108+
|active.png|
109+
110+
MicroPython Code Block:
111+
112+
.. code-block:: python
113+
114+
comlte_0.active(True)
115+
comlte_0.active(False)
116+
comlte_0.active()
117+
118+
119+
.. py:method:: connect(authmode=AUTH_NONE, username="", password="")
120+
121+
Initiate a PPP connection with the given parameters.
122+
123+
:param int authmode: Authentication Mode, either LTEModule.AUTH_NONE, LTEModule.AUTH_PAP, or LTEModule.AUTH_CHAP.
124+
:param str username: An optional user name to use with the authentication mode.
125+
:param str password: An optional password to use with the authentication mode.
126+
127+
:return: None
128+
129+
UiFlow2 Code Block:
130+
131+
|connect.png|
132+
133+
MicroPython Code Block:
134+
135+
.. code-block:: python
136+
137+
comlte_0.connect(authmode=AUTH_NONE, username="", password="")
138+
comlte_0.connect()
139+
140+
141+
.. py:method:: isconnected()
142+
143+
Returns True if the PPP link is connected and up. Returns False otherwise.
144+
145+
:return: True if the PPP link is connected and up, False otherwise.
146+
:rtype: bool
147+
148+
UiFlow2 Code Block:
149+
150+
|isconnected.png|
151+
152+
MicroPython Code Block:
153+
154+
.. code-block:: python
155+
156+
comlte_0.isconnected()
157+
158+
.. py:method:: ifconfig()
159+
160+
Get IP-level network interface parameters: IP address, subnet mask,
161+
gateway and DNS server. This method returns a 4-tuple with the above
162+
information.
163+
164+
:return: A 4-tuple with IP address, subnet mask, gateway and DNS server.
165+
166+
UiFlow2 Code Block:
167+
168+
|get_localip.png|
169+
170+
|get_subnet.png|
171+
172+
|get_gateway.png|
173+
174+
|get_dns.png|
175+
176+
MicroPython Code Block:
177+
178+
.. code-block:: python
179+
180+
comlte_0.ifconfig()
181+
comlte_0.ifconfig()[0] # IP address
182+
comlte_0.ifconfig()[1] # network
183+
comlte_0.ifconfig()[2] # gateway
184+
comlte_0.ifconfig()[3] # DNS server

docs/en/refs/module.lte.ref

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.. |COMX LTE| image:: https://static-cdn.m5stack.com/resource/docs/products/module/comx_lte/comx_lte_01.webp
2+
:target: https://docs.m5stack.com/en/module/comx_lte
3+
:height: 200px
4+
:width: 200px
5+
6+
.. |example_http.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/example_http.png
7+
.. |example_chat.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/example_chat.png
8+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/init.png
9+
.. |deinit.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/deinit.png
10+
.. |chat.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/chat.png
11+
.. |chat2.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/chat2.png
12+
.. |active.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/active.png
13+
.. |connect.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/connect.png
14+
.. |isconnected.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/isconnected.png
15+
.. |get_localip.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/get_localip.png
16+
.. |get_subnet.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/get_subnet.png
17+
.. |get_gateway.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/get_gateway.png
18+
.. |get_dns.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/com_lte/get_dns.png
19+
20+
21+
.. |core2_lte_chat_example.m5f2| raw:: html
22+
23+
<a
24+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/module/lte/core2_lte_chat_example.m5f2"
25+
target="_blank"
26+
>
27+
core2_lte_chat_example.m5f2
28+
</a>
29+
30+
31+
.. |core2_lte_http_example.m5f2| raw:: html
32+
33+
<a
34+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/module/lte/core2_lte_http_example.m5f2"
35+
target="_blank"
36+
>
37+
core2_lte_http_example.m5f2
38+
</a>
39+

0 commit comments

Comments
 (0)