Oliver Fabel 1 год назад
Родитель
Сommit
85dbee63f8
3 измененных файлов с 49 добавлено и 6 удалено
  1. 5 0
      docs/pages/assets/pwm_signal.txt
  2. 13 6
      docs/pages/examples.rst
  3. 31 0
      docs/pages/reference.rst

+ 5 - 0
docs/pages/assets/pwm_signal.txt

@@ -0,0 +1,5 @@
+────┐       ┌──┐    ┌────┐      ┌──┐              ┌────┐      ┌ ⋅ ⋅ ⋅
+    │       │  │    │    │      │  │              │    │      │
+    └───────┘  └────┘    └──────┘  └──────────────┘    └──────┘
+
+ 40 |  70   |20| 40 | 40 |  60  |20|     140      | 40 |  60  | ⋅ ⋅ ⋅

+ 13 - 6
docs/pages/examples.rst

@@ -2,6 +2,7 @@ Examples
 ========
 
 This page contains a few examples.
+See more on `GitHub <https://github.com/ofabel/mp-flipper/tree/master/examples>`_.
 
 Speaker
 -------
@@ -9,17 +10,15 @@ Speaker
 .. literalinclude:: ../../examples/flipperzero_speaker_test.py
    :language: python
 
+For details, see the :ref:`reference-speaker` section on the :doc:`reference` page.
+
 Input
 -----
 
 .. literalinclude:: ../../examples/flipperzero_draw_on_input_test.py
    :language: python
 
-Tic-Tac-Toe
------------
-
-.. literalinclude:: ../../examples/tic_tac_toe.py
-   :language: python
+For details, see the :ref:`reference-input` section on the :doc:`reference` page.
 
 Interrupts
 ----------
@@ -35,6 +34,8 @@ The following schematic circuit diagram shows the hardware setup for this exampl
 
    Hardware setup for the GPIO interrupt example.
 
+For details, see the :ref:`reference-gpio` section on the :doc:`reference` page.
+
 ADC
 ---
 
@@ -48,6 +49,8 @@ This example uses a voltage divider with the 3.3 V source from pin 9. The switch
 
    Hardware setup for the ADC example.
 
+For details, see the :ref:`reference-adc` section on the :doc:`reference` page.
+
 PWM
 ---
 
@@ -61,8 +64,12 @@ This example drives an LED connected to pin ``A7`` and ``GND`` using a PWM signa
 
    Hardware setup for the PWM example.
 
+For details, see the :ref:`reference-pwm` section on the :doc:`reference` page.
+
 Infrared
 --------
 
 .. literalinclude:: ../../examples/flipperzero_infrared_test.py
-   :language: python
+   :language: python
+
+For details, see the :ref:`reference-infrared` section on the :doc:`reference` page.

+ 31 - 0
docs/pages/reference.rst

@@ -10,6 +10,8 @@ Control the vibration motor of your Flipper.
 
 .. autofunction:: flipperzero.vibro_set
 
+.. _reference-light:
+
 Light
 -----
 
@@ -31,6 +33,8 @@ Functions
 .. autofunction:: flipperzero.light_blink_set_color
 .. autofunction:: flipperzero.light_blink_stop
 
+.. _reference-speaker:
+
 Speaker
 -------
 
@@ -166,6 +170,8 @@ Functions
 .. autofunction:: flipperzero.speaker_set_volume
 .. autofunction:: flipperzero.speaker_stop
 
+.. _reference-input:
+
 Input
 -----
 
@@ -195,6 +201,8 @@ Functions
 
 .. autodecorator:: flipperzero.on_input
 
+.. _reference-canvas:
+
 Canvas
 ------
 
@@ -251,6 +259,8 @@ Display message dialogs on the display for user infos and confirm actions.
 .. autofunction:: flipperzero.dialog_message_set_button
 .. autofunction:: flipperzero.dialog_message_show
 
+.. _reference-gpio:
+
 GPIO
 ----
 
@@ -302,6 +312,8 @@ Functions
 .. autofunction:: flipperzero.gpio_get_pin
 .. autodecorator:: flipperzero.on_gpio
 
+.. _reference-adc:
+
 ADC
 ---
 
@@ -336,6 +348,8 @@ Functions
 .. autofunction:: flipperzero.adc_read_pin_value
 .. autofunction:: flipperzero.adc_read_pin_voltage
 
+.. _reference-pwm:
+
 PWM
 ---
 
@@ -351,11 +365,28 @@ Functions
 .. autofunction:: flipperzero.pwm_stop
 .. autofunction:: flipperzero.pwm_is_running
 
+.. _reference-infrared:
+
 Infrared
 --------
 
 Send and receive infrared signals.
 
+Signal Format
+~~~~~~~~~~~~~
+
+The format to represent infrared signals uses a simple list of integers.
+Each value represents the duration between two signal edges in microseconds.
+Since this is a digital signal, there are only two levels: `high` and `low`.
+The timing list always starts with a `high` level.
+
+.. literalinclude:: ./assets/pwm_signal.txt
+   :language: text
+
+.. hint::
+
+   This is equal to the raw signal format of the `IR file <https://developer.flipper.net/flipperzero/doxygen/infrared_file_format.html>`_ specification.
+
 Functions
 ~~~~~~~~~