Skip to content

Commit

Permalink
Add line numbers to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Dec 27, 2019
1 parent cf3d10f commit 14dedc5
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/api-reference/apps/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Applications
============

.. toctree::
:maxdepth: 2
:glob:
:maxdepth: 2
:glob:

*
*
1 change: 1 addition & 0 deletions docs/api-reference/apps/mqtt_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ MQTT client v3.1.1 implementation, based on callback (non-netconn) connection AP

.. literalinclude:: ../../../snippets/mqtt_client.c
:language: c
:linenos:
:caption: MQTT application example code

.. doxygengroup:: ESP_APP_MQTT_CLIENT
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/apps/mqtt_client_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ MQTT Client API

.. literalinclude:: ../../../snippets/mqtt_client_api.c
:language: c
:linenos:
:caption: MQTT API application example code

.. doxygengroup:: ESP_APP_MQTT_CLIENT_API
7 changes: 5 additions & 2 deletions docs/api-reference/apps/netconn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Each time new packet is received (red block, *data received event*), reference t

.. literalinclude:: ../../../snippets/netconn_client.c
:language: c
:linenos:
:caption: Netconn client example

Netconn server
Expand Down Expand Up @@ -67,7 +68,8 @@ It waits for client and processes it in blocking mode.
Check netconn concurrency option to process multiple clients at the same time

.. literalinclude:: ../../../snippets/netconn_server_1thread.c
:language: c
:language: c
:linenos:
:caption: Netconn server with single processing thread

Netconn server concurrency
Expand All @@ -90,7 +92,8 @@ Every time *server application thread* (green block) gets new client to process,
* Higher memory footprint is necessary as there are multiple threads active

.. literalinclude:: ../../../snippets/netconn_server.c
:language: c
:language: c
:linenos:
:caption: Netconn server with multiple processing threads

Non-blocking receive
Expand Down
10 changes: 6 additions & 4 deletions docs/api-reference/esp/conn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ Example below shows *bare minimum* implementation to:
* Process received data in event and print number of received bytes

.. literalinclude:: ../../../snippets/client.c
:language: c
:caption: Client connection minimum example
:language: c
:linenos:
:caption: Client connection minimum example

Sending data
^^^^^^^^^^^^
Expand All @@ -54,8 +55,9 @@ Temporary buffer hence prevents many *send command* instructions as it is faster
than many of them with smaller chunks of bytes.

.. literalinclude:: ../../examples_src/conn_write.c
:language: c
:caption: Write data to connection output buffer
:language: c
:linenos:
:caption: Write data to connection output buffer

Transmit packet manually
************************
Expand Down
2 changes: 2 additions & 0 deletions docs/api-reference/esp/debug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ An example code with config and latter usage:

.. literalinclude:: ../../examples_src/debug_config.h
:language: c
:linenos:
:caption: Debug configuration setup

.. literalinclude:: ../../examples_src/debug.c
:language: c
:linenos:
:caption: Debug usage within middleware

.. doxygengroup:: ESP_DEBUG
5 changes: 4 additions & 1 deletion docs/api-reference/esp/pbuf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ An example code showing proper usage of concat operation:

.. literalinclude:: ../../examples_src/pbuf_cat.c
:language: c
:linenos:
:caption: Packet buffer concat example

Chain operation
Expand All @@ -137,6 +138,7 @@ An example code showing proper usage of chain operation:

.. literalinclude:: ../../examples_src/pbuf_chain.c
:language: c
:linenos:
:caption: Packet buffer chain example

Extract pbuf data
Expand All @@ -148,7 +150,8 @@ It is necessary to process block by block manually.
An example code showing proper reading of any *pbuf*:

.. literalinclude:: ../../examples_src/pbuf_extract.c
:language: c
:language: c
:linenos:
:caption: Packet buffer data extraction

.. doxygengroup:: ESP_PBUF
1 change: 1 addition & 0 deletions docs/api-reference/esp/sntp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ It is support through middleware API calls for configuring servers and reading a

.. literalinclude:: ../../../snippets/sntp.c
:language: c
:linenos:
:caption: Minimum SNTP example

.. doxygengroup:: ESP_SNTP
1 change: 1 addition & 0 deletions docs/api-reference/esp/sta.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ try to connect to AP from list of preferred one.

.. literalinclude:: ../../../snippets/station_manager.c
:language: c
:linenos:
:caption: Station manager used with all examples

.. doxygengroup:: ESP_STA
1 change: 1 addition & 0 deletions docs/get-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ This file shall be named ``esp_config.h`` and its default template looks like th

.. literalinclude:: ../../esp_at_lib/src/include/esp/esp_config_template.h
:language: c
:linenos:
:caption: Config file template
3 changes: 3 additions & 0 deletions docs/user-manual/blocking-nonblocking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Example code:

.. literalinclude:: ../examples_src/command_blocking.c
:language: c
:linenos:
:caption: Blocking command example

Non-blocking mode
Expand All @@ -40,6 +41,7 @@ Example code:

.. literalinclude:: ../examples_src/command_nonblocking.c
:language: c
:linenos:
:caption: Non-blocking command example

.. warning::
Expand All @@ -50,6 +52,7 @@ Example of a bad code:

.. literalinclude:: ../examples_src/command_nonblocking_bad.c
:language: c
:linenos:
:caption: Example of bad usage of non-blocking command

.. toctree::
Expand Down
3 changes: 3 additions & 0 deletions docs/user-manual/events-cb-fn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ custom, event function.

.. literalinclude:: ../../esp_at_lib/src/api/esp_netconn.c
:language: c
:linenos:
:caption: Netconn API module actual implementation

Connection specific event
Expand All @@ -68,6 +69,7 @@ Connection events callback function is set for ``2`` cases:

.. literalinclude:: ../../snippets/client.c
:language: c
:linenos:
:caption: An example of client with its dedicated event callback function

API call event
Expand All @@ -89,6 +91,7 @@ used to distinguis domain name (when multiple domains are to be resolved).

.. literalinclude:: ../../snippets/dns.c
:language: c
:linenos:
:caption: Simple example for API call event, using DNS module

.. toctree::
Expand Down
6 changes: 6 additions & 0 deletions docs/user-manual/porting-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Notes:

.. literalinclude:: ../../esp_at_lib/src/system/esp_ll_win32.c
:language: c
:linenos:
:caption: Actual implementation of low-level driver for WIN32

Example: Low-level driver for STM32
Expand All @@ -105,28 +106,33 @@ Notes:

.. literalinclude:: ../../esp_at_lib/src/system/esp_ll_stm32.c
:language: c
:linenos:
:caption: Actual implementation of low-level driver for STM32

Example: System functions for WIN32
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. literalinclude:: ../../esp_at_lib/src/include/system/port/win32/esp_sys_port.h
:language: c
:linenos:
:caption: Actual header implementation of system functions for WIN32

.. literalinclude:: ../../esp_at_lib/src/system/esp_sys_win32.c
:language: c
:linenos:
:caption: Actual implementation of system functions for WIN32

Example: System functions for CMSIS-OS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. literalinclude:: ../../esp_at_lib/src/include/system/port/cmsis_os/esp_sys_port.h
:language: c
:linenos:
:caption: Actual header implementation of system functions for CMSIS-OS based operating systems

.. literalinclude:: ../../esp_at_lib/src/system/esp_sys_cmsis_os.c
:language: c
:linenos:
:caption: Actual implementation of system functions for CMSIS-OS based operating systems

.. toctree::
Expand Down

0 comments on commit 14dedc5

Please sign in to comment.