Skip to content

Commit 8f5dcf1

Browse files
Tinyu-Zhaolbuque
authored andcommitted
lib/module: Add Commu module support.
Signed-off-by: Tinyu-Zhao <[email protected]>
1 parent d4f0d58 commit 8f5dcf1

File tree

15 files changed

+2083
-6
lines changed

15 files changed

+2083
-6
lines changed

docs/en/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"M5",
5252
"module.mbus",
5353
"network",
54-
"m5can"
54+
"m5can",
5555
]
5656

5757
autodoc_default_options = {

docs/en/module/commu.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Commu Module
2+
==============
3+
4+
.. sku: M011
5+
6+
.. include:: ../refs/module.commu.ref
7+
8+
This is the driver library for the module Commu for receiving and sending CAN / RS485 / I2C data.
9+
10+
Support the following products:
11+
12+
|commu|
13+
14+
15+
UiFlow2 Example
16+
---------------
17+
18+
CAN, RS485, I2C communication
19+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
21+
Open the |commu_core2_example.m5f2| project in UiFlow2.
22+
23+
This example shows how to receive and send data using the Commu Module.
24+
25+
UiFlow2 Code Block:
26+
27+
|example.png|
28+
29+
Example output:
30+
31+
None
32+
33+
MicroPython Example
34+
-------------------
35+
36+
CAN, RS485, I2C communication
37+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
39+
This example shows how to receive and send data using the Commu Module.
40+
41+
MicroPython Code Block:
42+
43+
.. literalinclude:: ../../../examples/module/commu/commu_core2_example.py
44+
:language: python
45+
:linenos:
46+
47+
Example output:
48+
49+
None
50+
51+
**API**
52+
-------
53+
54+
CommuModule
55+
^^^^^^^^^^^
56+
57+
.. autoclass:: module.commu.CommuModuleCAN
58+
:members:
59+
60+
.. autoclass:: module.commu.CommuModuleRS485
61+
:members:
62+
63+
The `CommuModuleRS485` class wraps an instance of the `UART` class.
64+
65+
For more details, see :ref:`hardware.UART <hardware.UART>`.
66+
67+
.. autoclass:: module.commu.CommuModuleI2C
68+
:members:
69+
70+
The `CommuModuleI2C` class wraps an instance of the `I2C` class.
71+
72+
For more details, see :ref:`machine.I2C <machine.I2C>`. -- a two-wire serial protocol.

docs/en/module/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Module
77
4in8out.rst
88
ain4.rst
99
bala2.rst
10+
commu.rst
1011
display.rst
1112
dmx.rst
1213
dualkmeter.rst

docs/en/refs/module.commu.ref

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. |commu| image:: https://static-cdn.m5stack.com/resource/docs/products/module/commu/commu_01.webp
2+
:target: https://docs.m5stack.com/en/module/commu
3+
:height: 200px
4+
:width: 200px
5+
6+
.. |init.png| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/module/commu/init.png
7+
.. |info.png| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/module/commu/info.png
8+
.. |get_irq_state.png| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/module/commu/get_irq_state.png
9+
.. |any.png| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/module/commu/any.png
10+
.. |recv_message.png| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/module/commu/recv_message.png
11+
.. |recv_message_into.png| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/module/commu/recv_message_into.png
12+
.. |send.png| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/module/commu/send.png
13+
14+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/module/commu/example.png
15+
16+
.. |commu_core2_example.m5f2| raw:: html
17+
18+
<a
19+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/module/commu/commu_core2_example.m5f2"
20+
target="_blank"
21+
>
22+
commu_core2_example.m5f2
23+
</a>

0 commit comments

Comments
 (0)