Skip to content

Commit b3e4371

Browse files
Tinyulbuque
authored andcommitted
docs: Supplemental Unit Documentation and Examples.
Signed-off-by: Tinyu <[email protected]>
1 parent 9d9fccf commit b3e4371

29 files changed

+2037
-130
lines changed

docs/en/refs/unit.adc_v11.ref

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
.. |ADCV11Unit| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/Unit-ADC_V1.1/img-240867ba-46d2-4cc6-beb9-79ac68af51d5.webp
3+
:target: https://docs.m5stack.com/en/unit/Unit-ADC_V1.1
4+
:height: 200px
5+
:width: 200px
6+
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/adc_v11/init.png
8+
.. |get_voltage.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/adc_v11/get_voltage.png
9+
.. |set_gain.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/adc_v11/set_gain.png
10+
.. |set_sample_rate.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/adc_v11/set_sample_rate.png
11+
.. |set_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/adc_v11/set_mode.png
12+
.. |get_adc_raw_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/adc_v11/get_adc_raw_value.png
13+
14+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/adc_v11/example.png
15+
16+
.. |adcv11_core2_example.m5f2| raw:: html
17+
18+
<a
19+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/adc_v11/adcv11_core2_example.m5f2"
20+
target="_blank"
21+
>
22+
adcv11_core2_example.m5f2
23+
</a>

docs/en/refs/unit.button.ref

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
.. |ButtonUnit| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/button/button_01.webp
3+
:target: https://docs.m5stack.com/en/unit/button
4+
:height: 200px
5+
:width: 200px
6+
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/button/init.png
8+
.. |isHolding.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/button/get_status.png
9+
.. |setCallback.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/button/callback.png
10+
.. |count_reset.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/button/count_reset.png
11+
.. |tick.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/button/tick.png
12+
13+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/button/example.png
14+
15+
.. |button_core2_example.m5f2| raw:: html
16+
17+
<a
18+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/button/button_core2_example.m5f2"
19+
target="_blank"
20+
>
21+
button_core2_example.m5f2
22+
</a>

docs/en/refs/unit.color.ref

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
.. |ColorUnit| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/COLOR/img-5e8f77b1-0a2d-4810-8b8d-c2374bd738fb.webp
3+
:target: https://docs.m5stack.com/en/unit/COLOR
4+
:height: 200px
5+
:width: 200px
6+
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/init.png
8+
.. |get_lux.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_lux.png
9+
.. |get_color_temperature.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_temperature.png
10+
.. |get_color_rgb_bytes.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_rgb_bytes.png
11+
.. |get_color_r.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_r.png
12+
.. |get_color_g.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_g.png
13+
.. |get_color_b.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_b.png
14+
.. |get_color_h.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_h.png
15+
.. |get_color_s.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_s.png
16+
.. |get_color_v.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_v.png
17+
.. |get_color.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color.png
18+
.. |get_color565.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color565.png
19+
.. |get_active.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_active.png
20+
.. |set_active.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/set_active.png
21+
.. |get_integration_time.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_integration_time.png
22+
.. |set_integration_time.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/set_integration_time.png
23+
.. |get_gain.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_gain.png
24+
.. |set_gain.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/set_gain.png
25+
.. |read_interrupt.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/read_interrupt.png
26+
.. |clear_interrupt.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/clear_interrupt.png
27+
.. |get_color_raw.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_color_raw.png
28+
.. |get_cycles.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_cycles.png
29+
.. |set_cycles.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/set_cycles.png
30+
.. |get_min_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_min_value.png
31+
.. |set_min_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/set_min_value.png
32+
.. |get_max_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_max_value.png
33+
.. |set_max_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/set_max_value.png
34+
.. |get_glass_attenuation.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/get_glass_attenuation.png
35+
.. |set_glass_attenuation.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/set_glass_attenuation.png
36+
37+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/color/example.png
38+
39+
.. |color_core2_example.m5f2| raw:: html
40+
41+
<a
42+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/color/color_core2_example.m5f2"
43+
target="_blank"
44+
>
45+
color_core2_example.m5f2
46+
</a>

docs/en/refs/unit.extio.ref

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
.. |EXTIOUnit| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/extio/extio_01.webp
3+
:target: https://docs.m5stack.com/en/unit/extio
4+
:height: 200px
5+
:width: 200px
6+
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/init.png
8+
.. |set_port_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/set_port_mode.png
9+
.. |set_pin_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/set_pin_mode.png
10+
.. |digit_write_port.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/digit_write_port.png
11+
.. |digit_write.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/digit_write.png
12+
.. |digit_read_port.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/digit_read_port.png
13+
.. |digit_read.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/digit_read.png
14+
.. |pin.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/pin.png
15+
16+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio/example.png
17+
18+
.. |extio_core2_example.m5f2| raw:: html
19+
20+
<a
21+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/extio/extio_core2_example.m5f2"
22+
target="_blank"
23+
>
24+
extio_core2_example.m5f2
25+
</a>

docs/en/refs/unit.extio2.ref

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
.. |EXTIO2Unit| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/extio2/extio2_01.webp
3+
:target: https://docs.m5stack.com/en/unit/extio2
4+
:height: 200px
5+
:width: 200px
6+
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/init.png
8+
.. |set_config_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/set_config_mode.png
9+
.. |write_output_pin.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/write_output_pin.png
10+
.. |write_servo_angle.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/write_servo_angle.png
11+
.. |write_servo_pulse.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/write_servo_pulse.png
12+
.. |write_rgb_led.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/write_rgb_led.png
13+
.. |set_address.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/set_address.png
14+
.. |get_config_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/get_config_mode.png
15+
.. |read_input_pin.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/read_input_pin.png
16+
.. |read_adc8_pin.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/read_adc8_pin.png
17+
.. |read_adc12_pin.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/read_adc12_pin.png
18+
.. |read_servo_angle.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/read_servo_angle.png
19+
.. |read_servo_pulse.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/read_servo_pulse.png
20+
.. |read_rgb_led.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/read_rgb_led.png
21+
.. |pin.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/pin.png
22+
23+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/extio2/example.png
24+
25+
.. |extio2_core2_example.m5f2| raw:: html
26+
27+
<a
28+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/extio2/extio2_core2_example.m5f2"
29+
target="_blank"
30+
>
31+
extio2_core2_example.m5f2
32+
</a>
33+

docs/en/refs/unit.limit.ref

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
.. |LimitUnit| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/Unit%20Limit/img-7da470fe-12b4-4694-bcd7-62077c1cce2e.webp
3+
:target: https://docs.m5stack.com/en/unit/Unit%20Limit
4+
:height: 200px
5+
:width: 200px
6+
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/limit/init.png
8+
.. |isHolding.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/limit/get_status.png
9+
.. |setCallback.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/limit/setCallback.png
10+
.. |count_reset.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/limit/count_reset.png
11+
.. |tick.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/limit/tick.png
12+
13+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/limit/example.png
14+
15+
.. |limit_core2_example.m5f2| raw:: html
16+
17+
<a
18+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/limit/limit_core2_example.m5f2"
19+
target="_blank"
20+
>
21+
limit_core2_example.m5f2
22+
</a>

docs/en/units/adc_v11.rst

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
2+
ADCV11Unit
3+
==========
4+
.. sku:U013-V11
5+
.. include:: ../refs/unit.adc_v11.ref
6+
7+
ADC V1.1 Unit is an A/D conversion module that utilizes the ADS1110 chip, a 16-bit self-calibrating analog-to-digital converter. It is designed with an I2C interface, offering convenient connectivity. The module offers conversion speeds of 8, 16, 32, and 128 samples per second (SPS), providing varying levels of accuracy at 16, 15, 14, and 12 bits of resolution respectively.
8+
9+
Support the following products:
10+
11+
|ADCV11Unit|
12+
13+
Micropython Example:
14+
15+
.. literalinclude:: ../../../examples/unit/adc_v11/adcv11_core2_example.py
16+
:language: python
17+
:linenos:
18+
19+
20+
UIFLOW2 Example:
21+
22+
|example.png|
23+
24+
.. only:: builder_html
25+
26+
|adcv11_core2_example.m5f2|
27+
28+
class ADCV11Unit
29+
----------------
30+
31+
Constructors
32+
------------
33+
34+
.. class:: ADCV11Unit(i2c)
35+
36+
Initialize the ADCV11Unit with an I2C or PAHUBUnit interface.
37+
38+
:param i2c: The I2C or PAHUBUnit instance used for communication.
39+
40+
UIFLOW2:
41+
42+
|init.png|
43+
44+
45+
Methods
46+
-------
47+
48+
.. method:: ADCV11Unit.get_voltage()
49+
50+
Get the measured voltage from the ADC V1.1 Unit.
51+
52+
:return: The measured voltage value, rounded to two decimal places.
53+
54+
UIFLOW2:
55+
56+
|get_voltage.png|
57+
58+
.. method:: ADCV11Unit.set_gain(gain)
59+
60+
Set the gain configuration for the ADC.
61+
62+
:param gain: The gain value to configure.
63+
64+
UIFLOW2:
65+
66+
|set_gain.png|
67+
68+
.. method:: ADCV11Unit.set_sample_rate(rate)
69+
70+
Configure the ADC's sampling rate.
71+
72+
73+
:param rate: The sample rate to set.
74+
75+
UIFLOW2:
76+
77+
|set_sample_rate.png|
78+
79+
.. method:: ADCV11Unit.set_mode(mode)
80+
81+
Set the ADC's operating mode.
82+
83+
:param mode: The mode to configure, e.g., continuous or single conversion.
84+
85+
UIFLOW2:
86+
87+
|set_mode.png|
88+
89+
.. method:: ADCV11Unit.set_config()
90+
91+
Update the ADC configuration register with the current settings.
92+
93+
.. method:: ADCV11Unit.get_adc_raw_value()
94+
95+
Read the raw ADC value.
96+
97+
UIFLOW2:
98+
99+
|get_adc_raw_value.png|
100+
101+

docs/en/units/button.rst

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
ButtonUnit
3+
==========
4+
5+
.. include:: ../refs/unit.button.ref
6+
7+
BUTTON is a single button Unit. The button status can be detected by the input pin by simply capturing the high/low electrical level. If the button is pressed, the signal level will be *high* if the button is released, the signal level will be *low*.
8+
9+
Support the following products:
10+
11+
|ButtonUnit|
12+
13+
Micropython Example:
14+
15+
.. literalinclude:: ../../../examples/unit/button/button_core2_example.py
16+
:language: python
17+
:linenos:
18+
19+
20+
UIFLOW2 Example:
21+
22+
|example.png|
23+
24+
.. only:: builder_html
25+
26+
|button_core2_example.m5f2|
27+
28+
class ButtonUnit
29+
----------------
30+
31+
Constructors
32+
------------
33+
34+
.. class:: ButtonUnit(pin_num, active_low, pullup_active)
35+
36+
Initialize a Button instance with the specified pin, active-low configuration, and pull-up resistor state.
37+
38+
:param pin_num: The GPIO pin number connected to the button.
39+
:param bool active_low: Determines whether the button signal is active-low. Default is True.
40+
:param bool pullup_active: Specifies whether the internal pull-up resistor is enabled. Default is True.
41+
42+
UIFLOW2:
43+
44+
|init.png|
45+
46+
Methods
47+
-------
48+
49+
.. method:: ButtonUnit.count_reset()
50+
51+
Reset the count value to zero.
52+
53+
54+
UIFLOW2:
55+
56+
|count_reset.png|
57+
58+
59+
.. method:: ButtonUnit.isHolding()
60+
61+
Check if the button is currently being held.
62+
63+
64+
UIFLOW2:
65+
66+
|isHolding.png|
67+
68+
.. method:: ButtonUnit.setCallback(type, cb)
69+
70+
Set a callback function for a specified button event type.
71+
72+
:param type: The event type (e.g., WAS_CLICKED, WAS_DOUBLECLICKED).
73+
:param cb: The callback function to be executed for the event.
74+
75+
UIFLOW2:
76+
77+
|setCallback.png|
78+
79+
.. method:: ButtonUnit.tick(pin)
80+
81+
Monitor the state transitions of a button based on its pin state and trigger appropriate handlers.
82+
83+
UIFLOW2:
84+
85+
|tick.png|

0 commit comments

Comments
 (0)