Skip to content

Commit 40ab315

Browse files
committed
libs/chain: Fix unable to trigger multiple callback events.
Signed-off-by: lbuque <1102390310@qq.com>
1 parent 9ec0392 commit 40ab315

15 files changed

Lines changed: 1207 additions & 12 deletions

docs/en/chain/chainbus.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Chain BUS
33

44
.. include:: ../refs/chain.bus.ref
55

6+
Chain BUS is a communication bus module that allows multiple devices to connect and communicate with each other in the M5Chain series devices.
7+
68
**API**
79
-------
810

docs/en/chain/joystick.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,44 @@ Chain Joystick
33

44
.. include:: ../refs/chain.joystick.ref
55

6+
Chain Joystick is a joystick module that can be connected to the M5Chain series devices. This module provides functions to read the joystick position and button states.
7+
8+
UiFlow2 Example
9+
---------------
10+
11+
USB Mouse
12+
^^^^^^^^^
13+
14+
Open the |chain_joystick_usb_mouse_example.m5f2| project in UiFlow2.
15+
16+
This example demonstrates how to use the Chain Joystick as a USB mouse.
17+
18+
UiFlow2 Code Block:
19+
20+
|chain_joystick_usb_mouse_example.png|
21+
22+
Example output:
23+
24+
None
25+
26+
MicroPython Example
27+
-------------------
28+
29+
USB Mouse
30+
^^^^^^^^^
31+
32+
This example demonstrates how to use the Chain Joystick as a USB mouse.
33+
34+
MicroPython Code Block:
35+
36+
.. literalinclude:: ../../../examples/chain/joystick/chain_joystick_usb_mouse_example.py
37+
:language: python
38+
:linenos:
39+
40+
Example output:
41+
42+
None
43+
644

745
**API**
846
-------

docs/en/chain/key.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,43 @@ Chain Key
33

44
.. include:: ../refs/chain.key.ref
55

6+
Chain Key is a key module that can be connected to the M5Chain series devices. This module provides functions to read the key states.
7+
8+
UiFlow2 Example
9+
---------------
10+
11+
USB Keyboard
12+
^^^^^^^^^^^^
13+
14+
Open the |chain_key_usb_keyboard_example.m5f2| project in UiFlow2.
15+
16+
This example demonstrates how to use the Chain Key as a USB keyboard.
17+
18+
UiFlow2 Code Block:
19+
20+
|chain_key_usb_keyboard_example.png|
21+
22+
Example output:
23+
24+
None
25+
26+
MicroPython Example
27+
-------------------
28+
29+
USB Keyboard
30+
^^^^^^^^^^^^
31+
32+
This example demonstrates how to use the Chain Key as a USB keyboard.
33+
34+
MicroPython Code Block:
35+
36+
.. literalinclude:: ../../../examples/chain/key/chain_key_usb_keyboard_example.py
37+
:language: python
38+
:linenos:
39+
40+
Example output:
41+
42+
None
643

744
**API**
845
-------

docs/en/refs/chain.joystick.ref

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
.. |chain_joystick_usb_mouse_example.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/joystick/chain_joystick_usb_mouse_example.png
22
.. |click_callback.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/joystick/click_callback.png
33
.. |double_click_callback.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/joystick/double_click_callback.png
44
.. |get_16bit_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/joystick/get_16bit_value.png
@@ -22,3 +22,12 @@
2222
.. |set_mapping_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/joystick/set_mapping_value.png
2323
.. |set_rgb_brightness.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/joystick/set_rgb_brightness.png
2424
.. |set_rgb_color.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/joystick/set_rgb_color.png
25+
26+
.. |chain_joystick_usb_mouse_example.m5f2| raw:: html
27+
28+
<a
29+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/chain/joystick/chain_joystick_usb_mouse_example.m5f2"
30+
target="_blank"
31+
>
32+
chain_joystick_usb_mouse_example.m5f2
33+
</a>

docs/en/refs/chain.key.ref

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.. |chain_key_usb_keyboard_example.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/key/chain_key_usb_keyboard_example.png
12
.. |double_click_callback.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/key/double_click_callback.png
23
.. |get_bootloader_version.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/key/get_bootloader_version.png
34
.. |get_button_double_click_trigger_interval.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/key/get_button_double_click_trigger_interval.png
@@ -15,3 +16,12 @@
1516
.. |set_button_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/key/set_button_mode.png
1617
.. |set_rgb_brightness.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/key/set_rgb_brightness.png
1718
.. |set_rgb_color.png| image:: https://static-cdn.m5stack.com/mpy_docs/chain/key/set_rgb_color.png
19+
20+
.. |chain_key_usb_keyboard_example.m5f2| raw:: html
21+
22+
<a
23+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/chain/key/chain_key_usb_keyboard_example.m5f2"
24+
target="_blank"
25+
>
26+
chain_key_usb_keyboard_example.m5f2
27+
</a>
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# SOME DESCRIPTIVE TITLE.
2+
# Copyright (C) 2016 - 2025 M5Stack Technology Co., Ltd
3+
# This file is distributed under the same license as the UIFlow2 Programming
4+
# Guide package.
5+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
6+
#
7+
#, fuzzy
8+
msgid ""
9+
msgstr ""
10+
"Project-Id-Version: UIFlow2 Programming Guide \n"
11+
"Report-Msgid-Bugs-To: \n"
12+
"POT-Creation-Date: 2025-11-24 09:26+0800\n"
13+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15+
"Language: zh_CN\n"
16+
"Language-Team: zh_CN <LL@li.org>\n"
17+
"Plural-Forms: nplurals=1; plural=0;\n"
18+
"MIME-Version: 1.0\n"
19+
"Content-Type: text/plain; charset=utf-8\n"
20+
"Content-Transfer-Encoding: 8bit\n"
21+
"Generated-By: Babel 2.17.0\n"
22+
23+
#: ../../en/chain/chainbus.rst:2 b72e588a4f804d21a05e99e31d7d394b
24+
msgid "Chain BUS"
25+
msgstr ""
26+
27+
#: ../../en/chain/chainbus.rst:6 8049fe6981e045d29ac7b9b597523672
28+
msgid ""
29+
"Chain BUS is a communication bus module that allows multiple devices to "
30+
"connect and communicate with each other in the M5Chain series devices."
31+
msgstr "Chain BUS 是一个通信总线模块,它允许 M5Chain 系列设备中的多个设备相互连接和通信。"
32+
33+
#: ../../en/chain/chainbus.rst:9 92895914138547139ede2433dc78e2bc
34+
msgid "**API**"
35+
msgstr "API参考"
36+
37+
#: ../../en/chain/chainbus.rst:12 9947e786783a403b8b6bc853f6c1f2a1
38+
msgid "ChainBUS"
39+
msgstr ""
40+
41+
#: 1db62ffdadf2437698d099b39c27df87 chain.chain.ChainBus:1 of
42+
msgid "Bases: :py:class:`object`"
43+
msgstr ""
44+
45+
#: 1d9542b736f14961aa986ec001bb10f2 chain.chain.ChainBus:1 of
46+
msgid "Create a Chain bus instance."
47+
msgstr "创建一个 Chain 总线实例。"
48+
49+
#: ../../en/chain/chainbus.rst 29e7f19e28b24ecbb6a1f9b7395f22ba
50+
#: chain.chain.ChainBus.send of
51+
msgid "Parameters"
52+
msgstr ""
53+
54+
#: 30abfa87f9244d26a5bfab57eee3dcc2 chain.chain.ChainBus:3 of
55+
msgid "UART ID."
56+
msgstr "UART 编号。"
57+
58+
#: chain.chain.ChainBus:4 e4946d6a163343bbaca428352bb9b6f0 of
59+
msgid "TX pin."
60+
msgstr "TX 引脚。"
61+
62+
#: 6dc3676b14bd40eca4a5ad0102a67b63 chain.chain.ChainBus:5 of
63+
msgid "RX pin."
64+
msgstr "RX 引脚。"
65+
66+
#: 4e0abac79262499eb24f69108a5a85a6 chain.chain.ChainBus:6 of
67+
msgid "Enable verbose mode. Default is False."
68+
msgstr "是否启用详细输出模式,默认 False。"
69+
70+
#: 8b574aa6414d4a759a33b869137530f1 chain.chain.ChainBus:8
71+
#: chain.chain.ChainBus.get_device_num:6 chain.chain.ChainBus.send:11 of
72+
msgid "UiFlow2 Code Block:"
73+
msgstr "UiFlow2 代码块:"
74+
75+
#: 58b3dc48a7bb4aa08cc6ba0db5beab52 chain.chain.ChainBus:10
76+
#: chain.chain.ChainBus.get_device_num:8 of
77+
msgid "|get_device_num.png|"
78+
msgstr ""
79+
80+
#: ../../en/refs/chain.bus.ref:2 e9042ed6668044a5b5ebc5e0dbc16c52
81+
msgid "get_device_num.png"
82+
msgstr ""
83+
84+
#: 5477f673d0f844f28364c0dead1972a3 chain.chain.ChainBus:12
85+
#: chain.chain.ChainBus.get_device_num:10 chain.chain.ChainBus.send:15 of
86+
msgid "MicroPython Code Block:"
87+
msgstr "MicroPython 代码块:"
88+
89+
#: a5d1619f55d7415bbbc1bc3c225f6601 chain.chain.ChainBus.send:1 of
90+
msgid "Send custom command to device."
91+
msgstr "向设备发送自定义命令。"
92+
93+
#: 6d858dc45c8b404bb2ce5cecf7df427d chain.chain.ChainBus.send:3 of
94+
msgid "Device ID."
95+
msgstr "设备 ID。"
96+
97+
#: c289fca75b474dc5ac635596b66ca9d1 chain.chain.ChainBus.send:4 of
98+
msgid "Command."
99+
msgstr "命令。"
100+
101+
#: 45cc2c28feda49eb8589817d4238ea02 chain.chain.ChainBus.send:5 of
102+
msgid "Data."
103+
msgstr "数据。"
104+
105+
#: 0d24202392e74f838f5de0835403f805 chain.chain.ChainBus.send:6 of
106+
msgid "receive timeout in milliseconds."
107+
msgstr "接收超时时间(毫秒)。"
108+
109+
#: 25213c4845174e0d82eac7f114023374 chain.chain.ChainBus.get_device_num
110+
#: chain.chain.ChainBus.send of
111+
msgid "Returns"
112+
msgstr ""
113+
114+
#: 594921dbedd14de5be81a8f17a5b7064 chain.chain.ChainBus.send:8 of
115+
msgid "Response data."
116+
msgstr "响应数据。"
117+
118+
#: 2646b444ec8c4241acf88c13c3dd958b chain.chain.ChainBus.get_device_num
119+
#: chain.chain.ChainBus.send of
120+
msgid "Return type"
121+
msgstr ""
122+
123+
#: cd2a13fbd7e44ff686a5422b9280f9be chain.chain.ChainBus.send:13 of
124+
msgid "|send.png|"
125+
msgstr ""
126+
127+
#: ../../en/refs/chain.bus.ref:4 2c47f1d75f8c46769d722d5b0af81597
128+
msgid "send.png"
129+
msgstr ""
130+
131+
#: 8d6b5e07d17045deac619e0c7776d935 chain.chain.ChainBus.get_device_num:1 of
132+
msgid "Get connected device number."
133+
msgstr "获取已连接设备数量。"
134+
135+
#: 35bd7a49891244009aab70c7009e2f4c chain.chain.ChainBus.get_device_num:3 of
136+
msgid "Number of connected devices."
137+
msgstr "已连接设备的数量。"
138+
139+
#: 4edf9a3fbc354f1081be6430993c6d55 chain.chain.ChainBus.deinit:1 of
140+
msgid "Deinitialize the Chain bus."
141+
msgstr "反初始化 Chain 总线。"
142+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SOME DESCRIPTIVE TITLE.
2+
# Copyright (C) 2016 - 2025 M5Stack Technology Co., Ltd
3+
# This file is distributed under the same license as the UIFlow2 Programming
4+
# Guide package.
5+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
6+
#
7+
#, fuzzy
8+
msgid ""
9+
msgstr ""
10+
"Project-Id-Version: UIFlow2 Programming Guide \n"
11+
"Report-Msgid-Bugs-To: \n"
12+
"POT-Creation-Date: 2025-11-14 15:08+0800\n"
13+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15+
"Language: zh_CN\n"
16+
"Language-Team: zh_CN <LL@li.org>\n"
17+
"Plural-Forms: nplurals=1; plural=0;\n"
18+
"MIME-Version: 1.0\n"
19+
"Content-Type: text/plain; charset=utf-8\n"
20+
"Content-Transfer-Encoding: 8bit\n"
21+
"Generated-By: Babel 2.17.0\n"
22+
23+
#: ../../en/chain/index.rst:2 016fc60c9c0d498a8c203db35b795401
24+
msgid "Chain"
25+
msgstr ""
26+

0 commit comments

Comments
 (0)