From ba57e3989f264b0b664a1e6d07252036494307df Mon Sep 17 00:00:00 2001 From: felixlubenben Date: Fri, 10 Nov 2023 15:09:38 +0800 Subject: [PATCH] Add Add copyright information of third-party libraries --- docs/en/refs/unit.pir.ref | 23 +++++++++ docs/en/units/index.rst | 1 + docs/en/units/pir.rst | 96 ++++++++++++++++++++++++++++++++++++ docs/zh_CN/refs/unit.pir.ref | 23 +++++++++ docs/zh_CN/unit/index.rst | 1 + docs/zh_CN/unit/pir.rst | 96 ++++++++++++++++++++++++++++++++++++ 6 files changed, 240 insertions(+) create mode 100644 docs/en/refs/unit.pir.ref create mode 100644 docs/en/units/pir.rst create mode 100644 docs/zh_CN/refs/unit.pir.ref create mode 100644 docs/zh_CN/unit/pir.rst diff --git a/docs/en/refs/unit.pir.ref b/docs/en/refs/unit.pir.ref new file mode 100644 index 00000000..cabc3f95 --- /dev/null +++ b/docs/en/refs/unit.pir.ref @@ -0,0 +1,23 @@ +.. |PIR| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/PIR/img-4647c010-1e57-4cc9-85e3-cbd450882074.webp + :target: https://docs.m5stack.com/en/unit/PIR + :height: 200px + :width: 200 px + + +.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/example.svg + +.. |init.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/init.svg + +.. |get_status.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/get_status.svg + +.. |enable_irq.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/enable_irq.svg + +.. |disable_irq.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/disable_irq.svg + +.. |set_callback.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/set_callback.svg + + +.. |pir_core_example.m5f2| raw:: html + + pir_core_example.m5f2 + diff --git a/docs/en/units/index.rst b/docs/en/units/index.rst index 46f3f14c..fe77216f 100644 --- a/docs/en/units/index.rst +++ b/docs/en/units/index.rst @@ -14,3 +14,4 @@ Unit light.rst dlight.rst ultrasonic.rst + pir.rst diff --git a/docs/en/units/pir.rst b/docs/en/units/pir.rst new file mode 100644 index 00000000..0d5b7403 --- /dev/null +++ b/docs/en/units/pir.rst @@ -0,0 +1,96 @@ +PIR Unit +================== + +.. include:: ../refs/unit.pir.ref + +Support the following products: + + +|PIR| + + +Micropython Example:: + + import os, sys, io + import M5 + from M5 import * + from hardware import * + from unit import * + + i2c0 = None + pir_0 = None + + def setup(): + global i2c0, pir_0 + + i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000) + pir_0 = PIR((8, 9)) + M5.begin() + Widgets.fillScreen(0x222222) + + print(pir_0.get_status()) + + + +UIFLOW2 Example: + + |example.svg| + +.. only:: builder_html + +|pir_core_example.m5f2| + +class PIR +----------------- + +Constructors +-------------- + +.. class:: PIR(IO1,IO2) + + Create a PIR object. + + The parameters are: + - ``IO1,IO2`` I2C pin. + + + UIFLOW2: + + |init.svg| + + +Methods +------- + +.. method:: PIR.get_status() + + + Get detection status. + + UIFLOW2: + + |get_status.svg| + +.. method:: PIR.enable_irq() + + Enable Human detection function. + + UIFLOW2: + + |enable_irq.svg| + +.. method:: PIR.disable_irq() + + Disable Human detection function. + + UIFLOW2: + + |disable_irq.svg| + +.. method:: PIR.set_callback() + + Polling method, placed in the loop function, constantly check. + + UIFLOW2: + + |set_callback.svg| diff --git a/docs/zh_CN/refs/unit.pir.ref b/docs/zh_CN/refs/unit.pir.ref new file mode 100644 index 00000000..2478c914 --- /dev/null +++ b/docs/zh_CN/refs/unit.pir.ref @@ -0,0 +1,23 @@ +.. |PIR| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/PIR/img-4647c010-1e57-4cc9-85e3-cbd450882074.webp + :target: https://docs.m5stack.com/zh_CN/unit/PIR + :height: 200px + :width: 200 px + + +.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/example.svg + +.. |init.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/init.svg + +.. |get_status.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/get_status.svg + +.. |enable_irq.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/enable_irq.svg + +.. |disable_irq.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/disable_irq.svg + +.. |set_callback.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/pir/set_callback.svg + + +.. |pir_core_example.m5f2| raw:: html + + pir_core_example.m5f2 + diff --git a/docs/zh_CN/unit/index.rst b/docs/zh_CN/unit/index.rst index 46f3f14c..fe77216f 100644 --- a/docs/zh_CN/unit/index.rst +++ b/docs/zh_CN/unit/index.rst @@ -14,3 +14,4 @@ Unit light.rst dlight.rst ultrasonic.rst + pir.rst diff --git a/docs/zh_CN/unit/pir.rst b/docs/zh_CN/unit/pir.rst new file mode 100644 index 00000000..f1c5c3c1 --- /dev/null +++ b/docs/zh_CN/unit/pir.rst @@ -0,0 +1,96 @@ +PIR Unit +================== + +.. include:: ../refs/unit.pir.ref + +Support the following products: + + +|PIR| + + +Micropython Example:: + + import os, sys, io + import M5 + from M5 import * + from hardware import * + from unit import * + + i2c0 = None + pir_0 = None + + def setup(): + global i2c0, pir_0 + + i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000) + pir_0 = PIR((8, 9)) + M5.begin() + Widgets.fillScreen(0x222222) + + print(pir_0.get_status()) + + + +UIFLOW2 Example: + + |example.svg| + +.. only:: builder_html + +|pir_core_example.m5f2| + +class PIR +----------------- + +Constructors +-------------- + +.. class:: PIR(IO1,IO2) + + 创建一个PIR对象. + + 参数是: + - ``IO1,IO2`` I2C引脚。 + + + UIFLOW2: + + |init.svg| + + +Methods +------- + +.. method:: PIR.get_status() + + + 获取检测状态 + + UIFLOW2: + + |get_status.svg| + +.. method:: PIR.enable_irq() + + 使能人体检测功能。 + + UIFLOW2: + + |enable_irq.svg| + +.. method:: PIR.disable_irq() + + 关闭人体检测功能。 + + UIFLOW2: + + |disable_irq.svg| + +.. method:: PIR.set_callback() + + 轮询方法,放在loop函数里面,不断检测。 + + UIFLOW2: + + |set_callback.svg|