Skip to content

Commit 8c1cd15

Browse files
committed
libs/module: Add PPS support. docs: Add DAC2 chinese version doc.
Signed-off-by: icyqwq <[email protected]>
1 parent 7cad76f commit 8c1cd15

File tree

14 files changed

+800
-1
lines changed

14 files changed

+800
-1
lines changed

docs/en/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ MicroPython documentation and references
99
controllers/index.rst
1010
software/index.rst
1111
hardware/index.rst
12+
module/index.rst
1213
units/index.rst
1314
quick-reference/index.rst
1415
COPYRIGHT.rst

docs/en/module/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Module
2+
======
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
7+
pps.rst

docs/en/module/pps.rst

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
PPS Module
2+
========
3+
4+
.. include:: ../refs/module.pps.ref
5+
6+
The `PPS` class controls a Programmable Power Supply (PPS), capable of providing an output up to 30V and 5A. It allows for precise control over the output voltage and current, with features to read back the actual output values and the module's status.
7+
8+
Support the following products:
9+
10+
|PPSModule|
11+
12+
Micropython Example::
13+
14+
import os, sys, io
15+
import M5
16+
from M5 import *
17+
from pps import PPS
18+
19+
pps = PPS(addr=0x35)
20+
pps.set_output_voltage(5.5)
21+
pps.set_output_current(1)
22+
pps.enable_output()
23+
24+
# Read values and status
25+
print("Voltage:", pps.read_output_voltage(), "V")
26+
print("Current:", pps.read_output_current(), "A")
27+
print("Mode:", pps.read_psu_running_mode())
28+
29+
UIFLOW2 Example:
30+
31+
|example.svg|
32+
33+
.. only:: builder_html
34+
35+
class PPS
36+
---------
37+
38+
Constructors
39+
-------------
40+
41+
.. class:: PPS(addr=0x35)
42+
43+
Creates a PPS object to interact with the programmable power supply.
44+
45+
- ``addr``: I2C address of the PPS device (default is `0x35`).
46+
47+
Methods
48+
-------
49+
50+
Methods
51+
----------------------
52+
53+
.. method:: PPS.set_output(enable: bool)
54+
55+
Enable or disable the PPS output.
56+
57+
- ``enable``: True to enable, False to disable.
58+
59+
UIFLOW2:
60+
61+
|set_output.svg|
62+
63+
.. method:: PPS.enable_output()
64+
65+
Enable the PPS output.
66+
67+
UIFLOW2:
68+
69+
|enable_output.svg|
70+
71+
.. method:: PPS.disable_output()
72+
73+
Disable the PPS output.
74+
75+
UIFLOW2:
76+
77+
|disable_output.svg|
78+
79+
.. method:: PPS.set_output_voltage(voltage: float)
80+
81+
Set the output voltage of the PPS.
82+
83+
- ``voltage``: Desired output voltage from 0.0 to 30.0 volts.
84+
85+
UIFLOW2:
86+
87+
|set_output_voltage.svg|
88+
89+
.. method:: PPS.set_output_current(current: float)
90+
91+
Set the output current of the PPS.
92+
93+
- ``current``: Desired output current from 0.0A to 5.0A.
94+
95+
UIFLOW2:
96+
97+
|set_output_current.svg|
98+
99+
.. method:: PPS.read_psu_running_mode() -> int
100+
101+
Read the PSU running mode.
102+
103+
UIFLOW2:
104+
105+
|read_psu_running_mode.svg|
106+
107+
.. method:: PPS.read_output_current() -> float
108+
109+
Read the current output current.
110+
111+
UIFLOW2:
112+
113+
|read_output_current.svg|
114+
115+
.. method:: PPS.read_output_voltage() -> float
116+
117+
Read the current output voltage.
118+
119+
UIFLOW2:
120+
121+
|read_output_voltage.svg|
122+
123+
.. method:: PPS.read_input_voltage() -> float
124+
125+
Read the input voltage.
126+
127+
UIFLOW2:
128+
129+
|read_input_voltage.svg|
130+
131+
.. method:: PPS.read_data_update_flag() -> int
132+
133+
Read the data update flag.
134+
135+
UIFLOW2:
136+
137+
|read_data_update_flag.svg|
138+
139+
.. method:: PPS.read_mcu_temperature() -> float
140+
141+
Read the MCU temperature.
142+
143+
UIFLOW2:
144+
145+
|read_mcu_temperature.svg|
146+
147+
.. method:: PPS.read_module_id() -> int
148+
149+
Read the module ID.
150+
151+
UIFLOW2:
152+
153+
|read_module_id.svg|
154+
155+
.. method:: PPS.read_uid() -> bytearray
156+
157+
Read the unique identifier (UID).
158+
159+
UIFLOW2:
160+
161+
|read_uid.svg|
162+
163+
.. method:: PPS.get_i2c_address() -> int
164+
165+
Get the current I2C address of the device.
166+
167+
UIFLOW2:
168+
169+
|get_i2c_address.svg|
170+
171+
.. method:: PPS.set_i2c_address(new_address: int)
172+
173+
Set a new I2C address for the device.
174+
175+
- ``new_address``: The new I2C address to set.
176+
177+
UIFLOW2:
178+
179+
|set_i2c_address.svg|

docs/en/refs/module.pps.ref

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. |PPSModule| image:: https://static-cdn.m5stack.com/resource/docs/products/module/PPS/img-XXXX.webp
2+
:target: https://docs.m5stack.com/en/module/PPS
3+
:height: 200px
4+
:width: 200px
5+
6+
.. |init.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/init.svg
7+
8+
.. |set_output.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/set_output.svg
9+
10+
.. |enable_output.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/enable_output.svg
11+
12+
.. |disable_output.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/disable_output.svg
13+
14+
.. |set_output_voltage.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/set_output_voltage.svg
15+
16+
.. |set_output_current.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/set_output_current.svg
17+
18+
.. |read_psu_running_mode.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/read_psu_running_mode.svg
19+
20+
.. |read_output_current.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/read_output_current.svg
21+
22+
.. |read_output_voltage.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/read_output_voltage.svg
23+
24+
.. |read_input_voltage.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/read_input_voltage.svg
25+
26+
.. |read_data_update_flag.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/read_data_update_flag.svg
27+
28+
.. |read_mcu_temperature.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/read_mcu_temperature.svg
29+
30+
.. |read_module_id.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/read_module_id.svg
31+
32+
.. |read_uid.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/read_uid.svg
33+
34+
.. |get_i2c_address.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/get_i2c_address.svg
35+
36+
.. |set_i2c_address.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/set_i2c_address.svg
37+
38+
.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/module/pps/example.svg

docs/zh_CN/module/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Module
55
:maxdepth: 1
66

77
dualkmeter.rst
8+
pps.rst

0 commit comments

Comments
 (0)