Skip to content

Commit

Permalink
Add ncir
Browse files Browse the repository at this point in the history
  • Loading branch information
felixlubenben committed Nov 13, 2023
1 parent ba57e39 commit 733651c
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/en/refs/unit.ncir.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. |NCIR| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/ncir/ncir_01.webp
:target: https://docs.m5stack.com/en/unit/ncir
:height: 200px
:width: 200 px


.. |example.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/example.svg

.. |init.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/init.svg

.. |get_ambient_temperature.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/get_object_temperature.svg

.. |get_object_temperature.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/enable_irq.svg



.. |ncir_core_example.m5f2| raw:: html

<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>

1 change: 1 addition & 0 deletions docs/en/units/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Unit
dlight.rst
ultrasonic.rst
pir.rst
ncir.rst
83 changes: 83 additions & 0 deletions docs/en/units/ncir.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
NCIR Unit
==================

.. include:: ../refs/unit.ncir.ref

Support the following products:


|NCIR|


Micropython Example::

import os, sys, io
import M5
from M5 import *
from hardware import *
from unit import *

i2c0 = None
ncir_0 = None

def setup():
global i2c0, ncir_0

i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
ncir_0 = NCIRUnit(i2c0)
M5.begin()
Widgets.fillScreen(0x222222)

print(ncir_0.get_ambient_temperature())
print(ncir_0.get_object_temperature())



UIFLOW2 Example:

|example.svg|

.. only:: builder_html

|ncir_core_example.m5f2|

class NCIRUnit
-----------------

Constructors
--------------

.. class:: NCIRUnit(i2c)

Create an NCIRUnit object.

The parameters is:
- ``i2c`` Define the i2c pin.


UIFLOW2:

|init.svg|


Methods
-------

.. method:: ncir.get_ambient_temperature()


Obtain the ambient temperature.

UIFLOW2:

|get_ambient_temperature.svg|

.. method:: ncir.get_object_temperature()

Get the temperature of the measured object.

UIFLOW2:

|get_object_temperature.svg|


20 changes: 20 additions & 0 deletions docs/zh_CN/refs/unit.ncir.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. |NCIR| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/ncir/ncir_01.webp
:target: https://docs.m5stack.com/zh_CN/unit/ncir
:height: 200px
:width: 200 px


.. |example.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/example.svg

.. |init.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/init.svg

.. |get_ambient_temperature.svg| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/mpy_docs/unit/ncir/get_object_temperature.svg

.. |get_object_temperature.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/enable_irq.svg



.. |ncir_core_example.m5f2| raw:: html

<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>

1 change: 1 addition & 0 deletions docs/zh_CN/unit/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Unit
dlight.rst
ultrasonic.rst
pir.rst
ncir.rst
83 changes: 83 additions & 0 deletions docs/zh_CN/unit/ncir.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
NCIR Unit
==================

.. include:: ../refs/unit.ncir.ref

Support the following products:


|NCIR|


Micropython Example::

import os, sys, io
import M5
from M5 import *
from hardware import *
from unit import *

i2c0 = None
ncir_0 = None

def setup():
global i2c0, ncir_0

i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
ncir_0 = NCIRUnit(i2c0)
M5.begin()
Widgets.fillScreen(0x222222)

print(ncir_0.get_ambient_temperature())
print(ncir_0.get_object_temperature())



UIFLOW2 Example:

|example.svg|

.. only:: builder_html

|ncir_core_example.m5f2|

class NCIRUnit
-----------------

Constructors
--------------

.. class:: NCIRUnit(i2c)

创建一个NCIRUnit对象.

The parameters is:
- ``i2c`` 定义i2c引脚。


UIFLOW2:

|init.svg|


Methods
-------

.. method:: ncir.get_ambient_temperature()


获取环境温度。

UIFLOW2:

|get_ambient_temperature.svg|

.. method:: ncir.get_object_temperature()

获取测量物体温度。

UIFLOW2:

|get_object_temperature.svg|


0 comments on commit 733651c

Please sign in to comment.