This is an automated email from the ASF dual-hosted git repository.

linguini1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 50352c5b757dcc8cf8f9bb5ba4de429109e6fc46
Author: Eren Terzioglu <[email protected]>
AuthorDate: Wed May 13 14:35:41 2026 +0200

    Docs/platforms/risc-v: Add Analog Comparator docs for esp32[-h2|-p4]
    
    Add Analog Comparator docs for esp32h2 and esp32p4
    
    Signed-off-by: Eren Terzioglu <[email protected]>
---
 .../risc-v/esp32h2/boards/esp32h2-devkit/index.rst | 32 ++++++++++++++++++++
 Documentation/platforms/risc-v/esp32h2/index.rst   |  1 +
 .../boards/esp32p4-function-ev-board/index.rst     | 34 ++++++++++++++++++++++
 Documentation/platforms/risc-v/esp32p4/index.rst   |  1 +
 4 files changed, 68 insertions(+)

diff --git 
a/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst 
b/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst
index 8e47c46925f..5703429f07c 100644
--- a/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst
+++ b/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst
@@ -108,6 +108,38 @@ show in units of mV)::
     3: channel: 2 value: 1
     4: channel: 3 value: 0
 
+analog_cmpr
+-----------
+
+Enables the analog comparator driver. Driver unit is registered as 
``/dev/anacmpr0``
+for analog comparator unit0. For each unit, the reference is either internal,
+comparing the source input against a fraction of VDD in 10% steps from 0% to 
70%
+(for example, 50% VDD triggers when the source crosses half the supply 
voltage), or
+external, comparing the source GPIO against the voltage on the external 
reference
+pin. Reference source and debounce timeout for each unit can be adjusted in
+``Analog Comparator Configuration``.
+
+Comparator GPIOs are fixed by hardware and cannot be remapped. Following table 
demonstrates
+which pins are dedicated for comparator:
+
+======== 
=================================================================================
+Pin      Role
+======== 
=================================================================================
+GPIO11   Input source for unit0
+GPIO10   External reference input (if external reference source is selected 
for unit0)
+======== 
=================================================================================
+
+The following snippet demonstrates how to read the comparator result:
+
+.. code-block:: C
+
+   int fd;
+   int ret;
+   int res;
+
+   fd = open("/dev/anacmpr0", O_RDONLY);
+   ret = read(fd, &res, sizeof(res));
+
 autopm
 ------
 
diff --git a/Documentation/platforms/risc-v/esp32h2/index.rst 
b/Documentation/platforms/risc-v/esp32h2/index.rst
index 9c24bbd465c..e14db7bba66 100644
--- a/Documentation/platforms/risc-v/esp32h2/index.rst
+++ b/Documentation/platforms/risc-v/esp32h2/index.rst
@@ -437,6 +437,7 @@ USB Serial       Yes
 Watchdog         Yes
 Wifi             No
 XTS              No
+Analog Comp      Yes
 ==============  ======= ====================
 
 Analog-to-digital converter (ADC)
diff --git 
a/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-function-ev-board/index.rst
 
b/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-function-ev-board/index.rst
index 7d9e2ca11b5..1a76190ad9a 100644
--- 
a/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-function-ev-board/index.rst
+++ 
b/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-function-ev-board/index.rst
@@ -179,6 +179,40 @@ adc
 Enables the ADC driver. ADC unit(s) are registered (``/dev/adc0`` as ADC1).
 Attenuation, mode, and channel set can be adjusted in ``ADC Configuration``.
 
+analog_cmpr
+-----------
+
+Enables the analog comparator driver. Driver unit is registered as 
``/dev/anacmpr0``
+for analog comparator unit0. For each unit, the reference is either internal,
+comparing the source input against a fraction of VDD in 10% steps from 0% to 
70%
+(for example, 50% VDD triggers when the source crosses half the supply 
voltage), or
+external, comparing the source GPIO against the voltage on the external 
reference
+pin. Reference source and debounce timeout for each unit can be adjusted in
+``Analog Comparator Configuration``.
+
+Comparator GPIOs are fixed by hardware and cannot be remapped. Following table 
demonstrates
+which pins are dedicated for comparator:
+
+======== 
=================================================================================
+Pin      Role
+======== 
=================================================================================
+GPIO52   Input source for unit0
+GPIO51   External reference input (if external reference source is selected 
for unit0)
+GPIO54   Input source for unit1
+GPIO53   External reference input (if external reference source is selected 
for unit1)
+======== 
=================================================================================
+
+The following snippet demonstrates how to read the comparator result:
+
+.. code-block:: C
+
+   int fd;
+   int ret;
+   int res;
+
+   fd = open("/dev/anacmpr0", O_RDONLY);
+   ret = read(fd, &res, sizeof(res));
+
 autopm
 ------
 
diff --git a/Documentation/platforms/risc-v/esp32p4/index.rst 
b/Documentation/platforms/risc-v/esp32p4/index.rst
index 550bab2974e..30764106a66 100644
--- a/Documentation/platforms/risc-v/esp32p4/index.rst
+++ b/Documentation/platforms/risc-v/esp32p4/index.rst
@@ -363,6 +363,7 @@ Watchdog           Yes     MWDT0/1 and RWDT
 Ethernet           Yes
 Brownout           No
 Debug Probe        No
+Analog Comp        Yes     COMP0/1
 ================= ======= ==================================
 
 LP Peripherals

Reply via email to