Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Dec 28, 2019
1 parent 5f28ebb commit 94d4801
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 27 deletions.
12 changes: 12 additions & 0 deletions docs/api-reference/config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _api_ow_config:

OW Configuration
================

This is the default configuration of the middleware.
When any of the settings shall be modified, it shall be done in dedicated application config ``ow_config.h`` file.

.. note::
Check :ref:`get_started` to create configuration file.

.. doxygengroup:: OW_CONFIG
8 changes: 4 additions & 4 deletions docs/api-reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ List of all the modules:

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

*
*/index

ow
config
port/index
devices/index
6 changes: 0 additions & 6 deletions docs/api-reference/ow_config.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/api-reference/ow_sys.rst

This file was deleted.

13 changes: 13 additions & 0 deletions docs/api-reference/port/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _api_ow_port:

Platform specific
=================

List of all the modules:

.. toctree::
:maxdepth: 2

ll
sys

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _api_ow_ll:

Low-level functions
===================
Low-level driver
================

.. doxygengroup:: OW_LL
15 changes: 15 additions & 0 deletions docs/api-reference/port/sys.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _api_ow_sys:

System functions
================

System function are used in conjunction with thread safety.
These are required when operating system is used and multiple threads
want to access to the same OneWire instance.

.. tip::
Check :ref:`um_thread_safety` and :ref:`um_porting_guide` for instructions on how to port.

Below is a list of function prototypes and its implementation details.

.. doxygengroup:: OW_SYS
11 changes: 10 additions & 1 deletion docs/user-manual/how-it-works.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
.. _how_it_works:
.. _um_how_it_works:

How it works
============

OneWire-UART library tends to use *UART* hardware of any microcontroller/embedded system,
to generate timing clock for OneWire signals.

Nowaways embedded systems allow many UART ports, usually many more vs requirements for the final application.
OneWire protocol needs precise timings and embedded systems (in 99.9%) do not have specific hardware to handle communication of this type.

Fortunately, OneWire timings match with UART timings at ``9600`` and ``115200`` bauds.

.. note::
Check `detailed tutorial from Maxim <https://www.maximintegrated.com/en/design/technical-documents/tutorials/2/214.html>`_ for more information.

.. toctree::
:maxdepth: 2
File renamed without changes.
5 changes: 3 additions & 2 deletions docs/user-manual/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ User manual

how-it-works
thread-safety
hw_connection
uart_timing
hw-connection
uart-timing
porting-guide
87 changes: 87 additions & 0 deletions docs/user-manual/porting-guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.. _um_porting_guide:

Porting guide
=============

Implement low-level driver
^^^^^^^^^^^^^^^^^^^^^^^^^^

Implementation of low-level driver is an essential part.
It links middleware with actual hardware design of the device.

Its implementation must provide ``4`` functions:

* To open/configure UART hardware
* To set UART baudrate on the fly
* To transmit/receive data over UART
* To close/de-init UART hardware

After these functions have been implemented (check below for references),
driver must link these functions to single driver structure of type :cpp:type:`ow_ll_drv_t`,
later used during instance initialization.

.. tip::
Check :ref:`api_ow_ll` for function prototypes.

Implement system functions
^^^^^^^^^^^^^^^^^^^^^^^^^^

System functions are required only if operating system mode is enabled, with :c:macro:`OW_CFG_OS`.

Its implementation structure is not the same as for low-level driver,
customer needs to implement fixed functions, with pre-defined name, starting with ``ow_sys_`` name.

System function must only support OS mutex management and has to provide:

* :cpp:func:`ow_sys_mutex_create` function to create new mutex
* :cpp:func:`ow_sys_mutex_delete` function to delete existing mutex
* :cpp:func:`ow_sys_mutex_wait` function to wait for mutex to be available
* :cpp:func:`ow_sys_mutex_release` function to release (give) mutex back

.. warning::
Application must define :c:macro:`OW_CFG_OS_MUTEX_HANDLE` for mutex type.
This shall be done in ``ow_config.h`` file.

.. tip::
Check :ref:`api_ow_sys` for function prototypes.

Example: Low-level driver for WIN32
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Example code for low-level porting on `WIN32` platform.
It uses native *Windows* features to open *COM* port and read/write from/to it.

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

Example: Low-level driver for STM32
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Example code for low-level porting on `STM32` platform.

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

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

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

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

.. literalinclude:: ../../onewire_uart/src/system/ow_sys_cmsis_os.c
:language: c
:linenos:
:caption: Actual implementation of system functions for CMSIS-OS


.. toctree::
:maxdepth: 2
2 changes: 1 addition & 1 deletion docs/user-manual/thread-safety.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _thread_safety:
.. _um_thread_safety:

Thread safety
=============
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _uart_timing:
.. _um_uart_timing:

UART and 1-Wire timing relation
================================
===============================

This part is explaining how UART and 1-Wire timings are connected together and what is important to take into consideration for stable and reliable communication.

Expand Down

0 comments on commit 94d4801

Please sign in to comment.