Skip to content

Commit 733651c

Browse files
committed
Add ncir
1 parent ba57e39 commit 733651c

File tree

6 files changed

+208
-0
lines changed

6 files changed

+208
-0
lines changed

docs/en/refs/unit.ncir.ref

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. |NCIR| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/ncir/ncir_01.webp
2+
:target: https://docs.m5stack.com/en/unit/ncir
3+
:height: 200px
4+
:width: 200 px
5+
6+
7+
.. |example.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/example.svg
8+
9+
.. |init.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/init.svg
10+
11+
.. |get_ambient_temperature.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/get_object_temperature.svg
12+
13+
.. |get_object_temperature.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/enable_irq.svg
14+
15+
16+
17+
.. |ncir_core_example.m5f2| raw:: html
18+
19+
<a href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/m5f2_examples/unit/ncir/ncir_core_example.m5f2" target="_blank">ncir_core_example.m5f2</a>
20+

docs/en/units/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ Unit
1515
dlight.rst
1616
ultrasonic.rst
1717
pir.rst
18+
ncir.rst

docs/en/units/ncir.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
NCIR Unit
2+
==================
3+
4+
.. include:: ../refs/unit.ncir.ref
5+
6+
Support the following products:
7+
8+
9+
|NCIR|
10+
11+
12+
Micropython Example::
13+
14+
import os, sys, io
15+
import M5
16+
from M5 import *
17+
from hardware import *
18+
from unit import *
19+
20+
i2c0 = None
21+
ncir_0 = None
22+
23+
def setup():
24+
global i2c0, ncir_0
25+
26+
i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
27+
ncir_0 = NCIRUnit(i2c0)
28+
M5.begin()
29+
Widgets.fillScreen(0x222222)
30+
31+
print(ncir_0.get_ambient_temperature())
32+
print(ncir_0.get_object_temperature())
33+
34+
35+
36+
UIFLOW2 Example:
37+
38+
|example.svg|
39+
40+
.. only:: builder_html
41+
42+
|ncir_core_example.m5f2|
43+
44+
class NCIRUnit
45+
-----------------
46+
47+
Constructors
48+
--------------
49+
50+
.. class:: NCIRUnit(i2c)
51+
52+
Create an NCIRUnit object.
53+
54+
The parameters is:
55+
- ``i2c`` Define the i2c pin.
56+
57+
58+
UIFLOW2:
59+
60+
|init.svg|
61+
62+
63+
Methods
64+
-------
65+
66+
.. method:: ncir.get_ambient_temperature()
67+
68+
69+
Obtain the ambient temperature.
70+
71+
UIFLOW2:
72+
73+
|get_ambient_temperature.svg|
74+
75+
.. method:: ncir.get_object_temperature()
76+
77+
Get the temperature of the measured object.
78+
79+
UIFLOW2:
80+
81+
|get_object_temperature.svg|
82+
83+

docs/zh_CN/refs/unit.ncir.ref

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. |NCIR| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/ncir/ncir_01.webp
2+
:target: https://docs.m5stack.com/zh_CN/unit/ncir
3+
:height: 200px
4+
:width: 200 px
5+
6+
7+
.. |example.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/example.svg
8+
9+
.. |init.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/init.svg
10+
11+
.. |get_ambient_temperature.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/get_object_temperature.svg
12+
13+
.. |get_object_temperature.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/enable_irq.svg
14+
15+
16+
17+
.. |ncir_core_example.m5f2| raw:: html
18+
19+
<a href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/m5f2_examples/unit/ncir/ncir_core_example.m5f2" target="_blank">ncir_core_example.m5f2</a>
20+

docs/zh_CN/unit/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ Unit
1515
dlight.rst
1616
ultrasonic.rst
1717
pir.rst
18+
ncir.rst

docs/zh_CN/unit/ncir.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
NCIR Unit
2+
==================
3+
4+
.. include:: ../refs/unit.ncir.ref
5+
6+
Support the following products:
7+
8+
9+
|NCIR|
10+
11+
12+
Micropython Example::
13+
14+
import os, sys, io
15+
import M5
16+
from M5 import *
17+
from hardware import *
18+
from unit import *
19+
20+
i2c0 = None
21+
ncir_0 = None
22+
23+
def setup():
24+
global i2c0, ncir_0
25+
26+
i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
27+
ncir_0 = NCIRUnit(i2c0)
28+
M5.begin()
29+
Widgets.fillScreen(0x222222)
30+
31+
print(ncir_0.get_ambient_temperature())
32+
print(ncir_0.get_object_temperature())
33+
34+
35+
36+
UIFLOW2 Example:
37+
38+
|example.svg|
39+
40+
.. only:: builder_html
41+
42+
|ncir_core_example.m5f2|
43+
44+
class NCIRUnit
45+
-----------------
46+
47+
Constructors
48+
--------------
49+
50+
.. class:: NCIRUnit(i2c)
51+
52+
创建一个NCIRUnit对象.
53+
54+
The parameters is:
55+
- ``i2c`` 定义i2c引脚。
56+
57+
58+
UIFLOW2:
59+
60+
|init.svg|
61+
62+
63+
Methods
64+
-------
65+
66+
.. method:: ncir.get_ambient_temperature()
67+
68+
69+
获取环境温度。
70+
71+
UIFLOW2:
72+
73+
|get_ambient_temperature.svg|
74+
75+
.. method:: ncir.get_object_temperature()
76+
77+
获取测量物体温度。
78+
79+
UIFLOW2:
80+
81+
|get_object_temperature.svg|
82+
83+

0 commit comments

Comments
 (0)