Skip to content

Commit 8374e32

Browse files
committed
Add op180 unit
1 parent c458754 commit 8374e32

File tree

6 files changed

+234
-0
lines changed

6 files changed

+234
-0
lines changed

docs/en/refs/unit.op180.ref

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. |OP180| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/OP180/img-a3e126ec-af40-4f42-a85e-880460d46f7d.webp
2+
:target: https://docs.m5stack.com/en/unit/OP180
3+
:height: 200px
4+
:width: 200 px
5+
6+
7+
.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/example.svg
8+
9+
.. |init.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/init.svg
10+
11+
.. |get_switch_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/get_switch_value.svg
12+
13+
.. |get_count_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/get_counter_value.svg
14+
15+
.. |reset_count_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/reset_counter_value.svg
16+
17+
18+
19+
.. |op180_core_example.m5f2| raw:: html
20+
21+
<a href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/m5f2_examples/unit/op180/op180_core_example.m5f2" target="_blank">op180_core_example.m5f2</a>
22+

docs/en/units/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ Unit
1818
ncir.rst
1919
relay.rst
2020
op90.rst
21+
op180.rst

docs/en/units/op180.rst

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
OP180 Unit
2+
==================
3+
4+
.. include:: ../refs/unit.OP180.ref
5+
6+
The following products are supported:
7+
8+
9+
|OP180|
10+
11+
12+
Micropython Example::
13+
14+
import os, sys, io
15+
import M5
16+
from M5 import *
17+
import time
18+
from unit import *
19+
20+
op180_0 = None
21+
22+
def setup():
23+
global op180_0
24+
25+
op180_0 = OPUnit((8, 9), type=1)
26+
M5.begin()
27+
Widgets.fillScreen(0x222222)
28+
29+
print(op180_0.get_value)
30+
time.sleep(1)
31+
print(op180_0.count_value)
32+
time.sleep(1)
33+
op180_0.count_reset()
34+
time.sleep(1)
35+
36+
37+
38+
UIFLOW2 Example:
39+
40+
|example.svg|
41+
42+
.. only:: builder_html
43+
44+
|op180_core_example.m5f2|
45+
46+
class OPUnit
47+
-----------------
48+
49+
Constructors
50+
--------------
51+
52+
.. class:: OP180(io)
53+
54+
Create an OP180 object.
55+
56+
The parameters is:
57+
- ``io`` is the detection pin.
58+
59+
60+
UIFLOW2:
61+
62+
|init.svg|
63+
64+
65+
Methods
66+
-------
67+
68+
.. method:: OP180.get_value()
69+
70+
71+
Gets the switch status.
72+
73+
UIFLOW2:
74+
75+
|get_switch_value.svg|
76+
77+
.. method:: OP180.count_value()
78+
79+
Get the count value.
80+
81+
UIFLOW2:
82+
83+
|get_count_value.svg|
84+
85+
.. method:: OP108.count_reset()
86+
87+
Reset the meter value.
88+
89+
UIFLOW2:
90+
91+
|reset_count_value.svg|
92+
93+
94+

docs/zh_CN/refs/unit.op180.ref

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. |OP180| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/OP180/img-a3e126ec-af40-4f42-a85e-880460d46f7d.webp
2+
:target: https://docs.m5stack.com/zh_CN/unit/OP180
3+
:height: 200px
4+
:width: 200 px
5+
6+
7+
.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/example.svg
8+
9+
.. |init.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/init.svg
10+
11+
.. |get_switch_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/get_switch_value.svg
12+
13+
.. |get_count_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/get_counter_value.svg
14+
15+
.. |reset_count_value.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/op180/reset_counter_value.svg
16+
17+
18+
19+
.. |op180_core_example.m5f2| raw:: html
20+
21+
<a href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/m5f2_examples/unit/op180/op180_core_example.m5f2" target="_blank">op180_core_example.m5f2</a>
22+

docs/zh_CN/unit/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ Unit
1818
ncir.rst
1919
relay.rst
2020
op90.rst
21+
op180.rst

docs/zh_CN/unit/op180.rst

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
OP180 Unit
2+
==================
3+
4+
.. include:: ../refs/unit.OP180.ref
5+
6+
支持以下产品:
7+
8+
9+
|OP180|
10+
11+
12+
Micropython Example::
13+
14+
import os, sys, io
15+
import M5
16+
from M5 import *
17+
import time
18+
from unit import *
19+
20+
op180_0 = None
21+
22+
def setup():
23+
global op180_0
24+
25+
op180_0 = OPUnit((8, 9), type=1)
26+
M5.begin()
27+
Widgets.fillScreen(0x222222)
28+
29+
print(op180_0.get_value)
30+
time.sleep(1)
31+
print(op180_0.count_value)
32+
time.sleep(1)
33+
op180_0.count_reset()
34+
time.sleep(1)
35+
36+
37+
38+
UIFLOW2 Example:
39+
40+
|example.svg|
41+
42+
.. only:: builder_html
43+
44+
|op180_core_example.m5f2|
45+
46+
class OPUnit
47+
-----------------
48+
49+
Constructors
50+
--------------
51+
52+
.. class:: OP180(io)
53+
54+
创建一个OP180对象.
55+
56+
参数如下:
57+
- ``io`` 为检测引脚。
58+
59+
60+
UIFLOW2:
61+
62+
|init.svg|
63+
64+
65+
Methods
66+
-------
67+
68+
.. method:: OP180.get_value()
69+
70+
71+
获取开关状态。
72+
73+
UIFLOW2:
74+
75+
|get_switch_value.svg|
76+
77+
.. method:: OP180.count_value()
78+
79+
获取计数值。
80+
81+
UIFLOW2:
82+
83+
|get_count_value.svg|
84+
85+
.. method:: OP180.count_reset()
86+
87+
重置计数值。
88+
89+
UIFLOW2:
90+
91+
|reset_count_value.svg|
92+
93+
94+

0 commit comments

Comments
 (0)