acassis commented on code in PR #12418:
URL: https://github.com/apache/nuttx/pull/12418#discussion_r1617780064
##########
Documentation/components/drivers/character/analog/dac/index.rst:
##########
@@ -0,0 +1,75 @@
+===========
+DAC Drivers
+===========
+
+- ``include/nuttx/analog/dac.h``. All structures and APIs needed
+ to work with DAtC drivers are provided in this header file. This
+ header file includes:
+
+ #. Structures and inerface descriptions needed to develop a
+ low-level, architecture-specific, DAC driver.
+ #. To register the DAC driver with a common DAC character
+ driver.
+ #. Interfaces needed for interfacing user programs with the
+ common DAC character driver.
+
+- ``drivers/analog/dac.c``. The implementation of the common DAC
+ character driver.
+
+Application Programming Interface
+=================================
+
+The first necessary thing to be done in order to use the DAC driver from an
+application is to include the correct header filer. It contains the
+Application Programming Interface to the PWM driver. To do so, include
+
+.. code-block:: c
+
+ #include <nuttx/analog/dac.h>
+
+DAC driver is registered as a POSIX character device driver into ``/dev``
+namespace. It is necessary to open the device to get a file descriptor for
+further operations. This can be done with standard POSIX ``open()`` call.
+
+Standard POSIX ``write()`` call is used to send data from an application to
+a controller. Structure ``dac_msg_s`` is used to pass the data/samples.
+
+.. c:struct:: dac_msg_s
+.. code-block:: c
+
+ begin_packed_struct struct dac_msg_s
+ {
+ /* The 8-bit DAC Channel */
+ uint8_t am_channel;
+ /* DAC convert result (4 bytes) */
+ int32_t am_data;
+ } end_packed_struct;
+
+Application Example
+~~~~~~~~~~~~~~~~~~~
+
+An example application can be found in ``nuttx-apps`` repository under
+path ``examples/dac``. It provides command line interface to write data
+to DAC channels.s
+
Review Comment:
Please add the nsh dac command in the terminal here
##########
Documentation/components/drivers/character/analog/dac/index.rst:
##########
@@ -0,0 +1,75 @@
+===========
+DAC Drivers
+===========
+
+- ``include/nuttx/analog/dac.h``. All structures and APIs needed
+ to work with DAtC drivers are provided in this header file. This
Review Comment:
```suggestion
to work with DAC drivers are provided in this header file. This
##########
Documentation/components/drivers/character/quadrature.rst:
##########
@@ -28,3 +28,86 @@ following locations:
for the specific processor ``<architecture>`` and for the
specific ``<chip>`` Quadrature Encoder peripheral devices.
+Application Programming Interface
+=================================
+
+The first thing to be done in order to use the quadrature encoder driver
+from an application is to include the correct header filer. It contains the
+Application Programming Interface to the driver. To do so, include
+
+.. code-block:: c
+
+ #include <nuttx/sensors/qencoder.h>
+
+Quadrature encoder driver is registered as a POSIX character device driver
+into ``/dev`` namespace. It is necessary to open the device to get a file
+descriptor for further operations. This can be done with standard POSIX
+``open()`` call.
+
+The driver is accessed only through ``ioctl`` interface, functions ``read``
+and ``write`` does not have any affect. Following ``ioctl`` commands are
+available:
+
+ * :c:macro:`QEIOC_POSITION`
+ * :c:macro:`QEIOC_RESET`
+ * :c:macro:`QEIOC_SETPOSMAX`
+ * :c:macro:`QEIOC_SETINDEX`
+ * :c:macro:`QEIOC_GETINDEX`
+
+.. c:macro:: QEIOC_POSITION
+
+This call gets the current position from the encoder driver. Argument
+of the call is a pointer to ``int32_t`` variable.
+
+.. c:macro:: QEIOC_RESET
+
+This command resets the current encoder positition to zero.
+
+.. c:macro:: QEIOC_SETPOSMAX
+
+The ``QEIOC_SETPOSMAX`` call sets the maximum position for the encoder.
+An argument is an ``uint32_t`` variable with the maximum position value.
+
+.. c:macro:: QEIOC_SETINDEX
+
+This ioctl sets the index position of the encoder. An argument is an
+``uint32_t`` variable with the maximum position value.
+
+.. c:macro:: QEIOC_GETINDEX
+
+This ioctl gets the index position of the encoder. An argument is a
+pointer to ``qe_index_s`` structure.
+
+.. c:struct:: qe_index_s
+.. code-block:: c
+
+ struct qe_index_s
+ {
+ /* Qencoder actual position */
+ int32_t qenc_pos;
+ /* Index last position */
+ int32_t indx_pos;
+ /* Number of index occurances */
+ int16_t indx_cnt;
+ };
+
+The pointer to this structure is used as an argument to ``QEIOC_GETINDEX``
+ioctl command. It gets the current encoder position, the last position of
+index and the number of index occurances.
+
+Application Example
+~~~~~~~~~~~~~~~~~~~
+
+An example application can be found in ``nuttx-apps`` repository under
+path ``examples/qencoder``. It demonstrates the basic data read
+from an encoder device.
Review Comment:
```suggestion
from an encoder device. Example:
.. code-block:: console
nsh> qe
1. 0
2. 0
3. 0
4. 1
5. 1
6. 1
7. 2
8. 2
9. 3
##########
Documentation/components/drivers/character/analog/dac/index.rst:
##########
@@ -0,0 +1,75 @@
+===========
+DAC Drivers
+===========
+
+- ``include/nuttx/analog/dac.h``. All structures and APIs needed
+ to work with DAtC drivers are provided in this header file. This
+ header file includes:
+
+ #. Structures and inerface descriptions needed to develop a
+ low-level, architecture-specific, DAC driver.
+ #. To register the DAC driver with a common DAC character
+ driver.
+ #. Interfaces needed for interfacing user programs with the
+ common DAC character driver.
+
+- ``drivers/analog/dac.c``. The implementation of the common DAC
+ character driver.
+
+Application Programming Interface
+=================================
+
+The first necessary thing to be done in order to use the DAC driver from an
+application is to include the correct header filer. It contains the
+Application Programming Interface to the PWM driver. To do so, include
+
+.. code-block:: c
+
+ #include <nuttx/analog/dac.h>
+
+DAC driver is registered as a POSIX character device driver into ``/dev``
Review Comment:
```suggestion
DAC driver is registered as a POSIX character device file into ``/dev``
##########
Documentation/components/drivers/character/timers/pwm.rst:
##########
@@ -32,3 +32,171 @@ Files supporting PWM can be found in the following
locations:
in ``arch/<architecture>/src/<hardware>``
directory for the specific processor ``<architecture>`` and for
the specific ``<chip>`` PWM peripheral devices.
+
+Application Level Interface
+===========================
+
+The first necessary thing to be done in order to use the PWM driver in an
+application is to include the header file for the NuttX timer driver. It
contains
+the Application Level Interface to the PWM driver. To do so, include:
+
+.. code-block:: c
+
+ #include <nuttx/timers/pwm.h>
+
+PWM driver is registered as a POSIX character device into ``/dev`` namespace.
Review Comment:
```suggestion
PWM driver is registered as a POSIX character device file into ``/dev``
namespace.
##########
Documentation/components/drivers/character/quadrature.rst:
##########
@@ -28,3 +28,86 @@ following locations:
for the specific processor ``<architecture>`` and for the
specific ``<chip>`` Quadrature Encoder peripheral devices.
+Application Programming Interface
+=================================
+
+The first thing to be done in order to use the quadrature encoder driver
+from an application is to include the correct header filer. It contains the
+Application Programming Interface to the driver. To do so, include
+
+.. code-block:: c
+
+ #include <nuttx/sensors/qencoder.h>
+
+Quadrature encoder driver is registered as a POSIX character device driver
Review Comment:
```suggestion
Quadrature encoder driver is registered as a POSIX character device file
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]