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 <eren.terzioglu@espressif.com>
This commit is contained in:
Eren Terzioglu
2026-05-13 14:35:41 +02:00
committed by Matteo Golin
parent 2769b27efd
commit 50352c5b75
4 changed files with 68 additions and 0 deletions
@@ -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
------
@@ -437,6 +437,7 @@ USB Serial Yes
Watchdog Yes
Wifi No
XTS No
Analog Comp Yes
============== ======= ====================
Analog-to-digital converter (ADC)
@@ -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
------
@@ -363,6 +363,7 @@ Watchdog Yes MWDT0/1 and RWDT
Ethernet Yes
Brownout No
Debug Probe No
Analog Comp Yes COMP0/1
================= ======= ==================================
LP Peripherals