Skip to content

Commit e101917

Browse files
committed
docs: Add example.
Signed-off-by: lbuque <[email protected]>
1 parent bc5d30b commit e101917

27 files changed

+881
-81
lines changed

docs/en/hardware/can.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Example usage for classic CAN controller in Loopback (transceiver-less) mode::
1818
can.recv(0) # receive message
1919

2020

21+
For detailed examples, please refer to: :ref:`unit.CANUnit <unit.CANUnit>`
22+
23+
2124
Constructors
2225
------------
2326

docs/en/hardware/mic.rst

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,21 @@ the detailed Mic support for the host:
3333
.. |S| unicode:: U+2714
3434

3535

36-
Micropython Example::
36+
Micropython Example:
3737

38-
pass
38+
.. literalinclude:: ../../../examples/hardware/mic/cores3_mic_example.py
39+
:language: python
40+
:linenos:
3941

4042

41-
UIFLOW2 Example::
43+
UIFLOW2 Example:
4244

43-
pass
45+
|example.png|
46+
47+
48+
.. only:: builder_html
49+
50+
|cores3_mic_example.m5f2|
4451

4552

4653
class Mic
@@ -97,19 +104,19 @@ Methods
97104

98105
Mic.config("pin_data_in")
99106

100-
|get_config_boolean.svg|
107+
|get_config_boolean.png|
101108

102-
|get_config_int.svg|
109+
|get_config_int.png|
103110

104111
Set property:
105112

106113
Python::
107114

108115
Mic.config(pin_data_in=1)
109116

110-
|set_config_int.svg|
117+
|set_config_int.png|
111118

112-
|set_config_boolean.svg|
119+
|set_config_boolean.png|
113120

114121

115122
.. method:: Mic.begin() -> bool
@@ -118,7 +125,7 @@ Methods
118125

119126
UIFLOW2:
120127

121-
|begin.svg|
128+
|begin.png|
122129

123130

124131
.. method:: Mic.end() -> bool
@@ -127,7 +134,7 @@ Methods
127134

128135
UIFLOW2:
129136

130-
|end.svg|
137+
|end.png|
131138

132139

133140
.. method:: Mic.isRunning() -> bool
@@ -136,7 +143,7 @@ Methods
136143

137144
UIFLOW2:
138145

139-
|isRunning.svg|
146+
|isRunning.png|
140147

141148

142149
.. method:: Mic.isEnabled() -> bool
@@ -145,7 +152,7 @@ Methods
145152

146153
UIFLOW2:
147154

148-
|isEnabled.svg|
155+
|isEnabled.png|
149156

150157

151158
.. method:: Mic.isRecording() -> int
@@ -160,7 +167,7 @@ Methods
160167

161168
UIFLOW2:
162169

163-
|isRecording.svg|
170+
|isRecording.png|
164171

165172

166173
.. method:: Mic.setSampleRate(sample_rate) -> None
@@ -169,7 +176,7 @@ Methods
169176

170177
UIFLOW2:
171178

172-
|setSampleRate.svg|
179+
|setSampleRate.png|
173180

174181

175182
.. method:: Mic.record(rec_data[, rate[, stereo]]) -> bool
@@ -182,7 +189,7 @@ Methods
182189

183190
UIFLOW2:
184191

185-
|record.svg|
192+
|record.png|
186193

187194

188195
class mic_config_t

docs/en/hardware/rotary.rst

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,54 +22,21 @@ is the detailed Rotary support for the host:
2222
.. |S| unicode:: U+2714
2323

2424

25-
Micropython Example::
25+
Micropython Example:
2626

27-
import os, sys, io
28-
import M5
29-
from M5 import *
30-
from hardware import *
27+
.. literalinclude:: ../../../examples/hardware/rotary/dial_rotary_example.py
28+
:language: python
29+
:linenos:
3130

32-
label0 = None
33-
rotary = None
3431

35-
def btnA_wasClicked_event(state):
36-
global label0, rotary
37-
rotary.reset_rotary_value()
38-
label0.setText(str(rotary.get_rotary_value()))
39-
40-
def setup():
41-
global label0, rotary
42-
43-
M5.begin()
44-
Widgets.fillScreen(0x222222)
45-
label0 = Widgets.Label("0", 96, 80, 1.0, 0xffa000, 0x222222, Widgets.FONTS.DejaVu72)
46-
47-
BtnA.setCallback(type=BtnA.CB_TYPE.WAS_CLICKED, cb=btnA_wasClicked_event)
48-
49-
rotary = Rotary()
50-
51-
def loop():
52-
global label0, rotary
53-
M5.update()
54-
if rotary.get_rotary_status():
55-
label0.setText(str(rotary.get_rotary_value()))
32+
UIFLOW2 Example:
5633

57-
if __name__ == '__main__':
58-
try:
59-
setup()
60-
while True:
61-
loop()
62-
except (Exception, KeyboardInterrupt) as e:
63-
try:
64-
from utility import print_error_msg
65-
print_error_msg(e)
66-
except ImportError:
67-
print("please update to latest firmware")
34+
|example.png|
6835

6936

70-
UIFLOW2 Example:
37+
.. only:: builder_html
7138

72-
|example.svg|
39+
|dial_rotary_example.m5f2|
7340

7441

7542
class Rotary
@@ -84,7 +51,7 @@ Constructors
8451

8552
UIFLOW2:
8653

87-
|init.svg|
54+
|init.png|
8855

8956
Methods
9057
-------
@@ -95,7 +62,7 @@ Methods
9562

9663
UIFLOW2:
9764

98-
|get_rotary_status.svg|
65+
|get_rotary_status.png|
9966

10067

10168
.. method:: Rotary.get_rotary_value() -> int
@@ -106,7 +73,7 @@ Methods
10673

10774
UIFLOW2:
10875

109-
|get_rotary_value.svg|
76+
|get_rotary_value.png|
11077

11178

11279
.. method:: Rotary.get_rotary_increments() -> int
@@ -118,7 +85,7 @@ Methods
11885

11986
UIFLOW2:
12087

121-
|get_rotary_increments.svg|
88+
|get_rotary_increments.png|
12289

12390

12491
.. method:: Rotary.reset_rotary_value() -> None
@@ -127,7 +94,7 @@ Methods
12794

12895
UIFLOW2:
12996

130-
|reset_rotary_value.svg|
97+
|reset_rotary_value.png|
13198

13299

133100
.. method:: Rotary.set_rotary_value() -> None
@@ -136,4 +103,4 @@ Methods
136103

137104
UIFLOW2:
138105

139-
|set_rotary_value.svg|
106+
|set_rotary_value.png|

docs/en/refs/hardware.mic.ref

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11

2-
.. |get_config_boolean.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/get_config_boolean.svg
2+
.. |get_config_boolean.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/get_config_boolean.png
33

4-
.. |get_config_int.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/get_config_int.svg
4+
.. |get_config_int.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/get_config_int.png
55

6-
.. |set_config_int.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/set_config_int.svg
6+
.. |set_config_int.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/set_config_int.png
77

8-
.. |set_config_boolean.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/set_config_boolean.svg
8+
.. |set_config_boolean.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/set_config_boolean.png
99

10-
.. |begin.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/begin.svg
10+
.. |begin.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/begin.png
1111

12-
.. |end.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/end.svg
12+
.. |end.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/end.png
1313

14-
.. |isRunning.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/isRunning.svg
14+
.. |isRunning.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/isRunning.png
1515

16-
.. |isEnabled.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/isEnabled.svg
16+
.. |isEnabled.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/isEnabled.png
1717

18-
.. |isRecording.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/isRecording.svg
18+
.. |isRecording.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/isRecording.png
1919

20-
.. |setSampleRate.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/setSampleRate.svg
20+
.. |setSampleRate.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/setSampleRate.png
2121

22-
.. |record.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/record.svg
22+
.. |record.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/record.png
23+
24+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/microphone/example.png
25+
26+
.. |cores3_mic_example.m5f2| raw:: html
27+
28+
<a
29+
href="https://uiflow2.m5stack.com/?pkey=e1d3556776dd425a9dd8b46ec5984bea"
30+
target="_blank"
31+
>
32+
cores3_mic_example.m5f2
33+
</a>

docs/en/refs/hardware.rotary.ref

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/example.svg
1+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/example.png
22

3-
.. |init.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/init.svg
3+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/init.png
44

5-
.. |get_rotary_status.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/get_rotary_status.svg
5+
.. |get_rotary_status.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/get_rotary_status.png
66

7-
.. |get_rotary_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/get_rotary_value.svg
7+
.. |get_rotary_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/get_rotary_value.png
88

9-
.. |reset_rotary_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/reset_rotary_value.svg
9+
.. |reset_rotary_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/reset_rotary_value.png
1010

11-
.. |set_rotary_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/set_rotary_value.svg
11+
.. |set_rotary_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/set_rotary_value.png
1212

13-
.. |get_rotary_increments.svg| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/get_rotary_increments.svg
13+
.. |get_rotary_increments.png| image:: https://static-cdn.m5stack.com/mpy_docs/hardware/rotary/get_rotary_increments.png
14+
15+
.. |dial_rotary_example.m5f2| raw:: html
16+
17+
<a
18+
href="https://uiflow2.m5stack.com/?pkey=7a1c8a20e6ef4a51acce65d794a7681c"
19+
target="_blank"
20+
>
21+
dial_rotary_example.m5f2
22+
</a>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/init.png
2+
3+
.. |is_connected.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/is_connected.png
4+
5+
.. |connect.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/connect.png
6+
7+
.. |any.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/any.png
8+
9+
.. |read_all.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/read_all.png
10+
11+
.. |read_bytes.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/read_bytes.png
12+
13+
.. |read_raw_data.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/read_raw_data.png
14+
15+
.. |readline.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/readline.png
16+
17+
.. |write.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/write.png
18+
19+
.. |write1.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/write1.png
20+
21+
.. |write_line.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/write_line.png
22+
23+
.. |write_list.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/write_list.png
24+
25+
.. |write_raw_data.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/write_raw_data.png
26+
27+
.. |write_raw_data1.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/write_raw_data1.png
28+
29+
.. |close.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/close.png
30+
31+
.. |deinit.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/deinit.png
32+
33+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/client/example.png
34+
35+
.. |atoms3_bleuart_client_example.m5f2| raw:: html
36+
37+
<a
38+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/system/bleuart/atoms3_bleuart_client_example.py"
39+
target="_blank"
40+
>
41+
atoms3_bleuart_client_example.m5f2
42+
</a>

docs/en/refs/system.bleuart.ref

Whitespace-only changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/init.png
2+
3+
.. |any.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/any.png
4+
5+
.. |read_all.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/read_all.png
6+
7+
.. |read_bytes.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/read_bytes.png
8+
9+
.. |read_raw_data.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/read_raw_data.png
10+
11+
.. |readline.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/readline.png
12+
13+
.. |write.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/write.png
14+
15+
.. |write1.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/write1.png
16+
17+
.. |write_line.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/write_line.png
18+
19+
.. |write_list.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/write_list.png
20+
21+
.. |write_raw_data.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/write_raw_data.png
22+
23+
.. |write_raw_data1.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/write_raw_data1.png
24+
25+
.. |close.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/close.png
26+
27+
.. |deinit.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/deinit.png
28+
29+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/system/ble_uart/server/example.png
30+
31+
.. |cores3_bleuart_server_example.m5f2| raw:: html
32+
33+
<a
34+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/system/bleuart/cores3_bleuart_server_example.m5f2"
35+
target="_blank"
36+
>
37+
cores3_bleuart_server_example.m5f2
38+
</a>

0 commit comments

Comments
 (0)