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 2769b27efd5c69c146cf8a1b75263cc4374bf704
Author: Eren Terzioglu <[email protected]>
AuthorDate: Tue May 12 11:52:04 2026 +0200

    boards/risc-v/espressif: Add Analog Comparator board support for 
esp32[-h2|-p4]
    
    Add Analog Comparator board support for esp32p4 and esp32h2
    
    Signed-off-by: Eren Terzioglu <[email protected]>
---
 .../esp32h2-devkit/configs/analog_cmpr/defconfig   | 48 ++++++++++++++++++++++
 .../esp32h2/esp32h2-devkit/src/esp32h2_bringup.c   | 13 ++++++
 .../configs/analog_cmpr/defconfig                  | 48 ++++++++++++++++++++++
 .../src/esp32p4_bringup.c                          | 22 ++++++++++
 4 files changed, 131 insertions(+)

diff --git a/boards/risc-v/esp32h2/esp32h2-devkit/configs/analog_cmpr/defconfig 
b/boards/risc-v/esp32h2/esp32h2-devkit/configs/analog_cmpr/defconfig
new file mode 100644
index 00000000000..2e97b95fae9
--- /dev/null
+++ b/boards/risc-v/esp32h2/esp32h2-devkit/configs/analog_cmpr/defconfig
@@ -0,0 +1,48 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="risc-v"
+CONFIG_ARCH_BOARD="esp32h2-devkit"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32H2_DEVKIT=y
+CONFIG_ARCH_CHIP="esp32h2"
+CONFIG_ARCH_CHIP_ESP32H2=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_IRQ_TO_NDX=y
+CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
+CONFIG_ARCH_NUSER_INTERRUPTS=17
+CONFIG_ARCH_RISCV=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_BOARDCTL_RESET=y
+CONFIG_BOARD_LOOPSPERMSEC=15000
+CONFIG_BUILTIN=y
+CONFIG_ESPRESSIF_ANA_COMPR0=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_NSH_STRERROR=y
+CONFIG_PREALLOC_TIMERS=0
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_BACKTRACE=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=29
+CONFIG_START_MONTH=11
+CONFIG_START_YEAR=2019
+CONFIG_SYSTEM_DUMPSTACK=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TESTING_GETPRIME=y
+CONFIG_TESTING_OSTEST=y
+CONFIG_UART0_SERIAL_CONSOLE=y
diff --git a/boards/risc-v/esp32h2/esp32h2-devkit/src/esp32h2_bringup.c 
b/boards/risc-v/esp32h2/esp32h2-devkit/src/esp32h2_bringup.c
index e04356a756a..0540d712cc2 100644
--- a/boards/risc-v/esp32h2/esp32h2-devkit/src/esp32h2_bringup.c
+++ b/boards/risc-v/esp32h2/esp32h2-devkit/src/esp32h2_bringup.c
@@ -125,6 +125,10 @@
 #  include "espressif/esp_aes.h"
 #endif
 
+#ifdef CONFIG_COMP
+#  include "espressif/esp_ana_cmpr.h"
+#endif
+
 #ifdef CONFIG_PM
 #  include "espressif/esp_pm.h"
 #endif
@@ -474,6 +478,15 @@ int esp_bringup(void)
     }
 #endif
 
+#ifdef CONFIG_ESPRESSIF_ANA_COMPR0
+  ret = esp_cmprinitialize(ESPRESSIF_COMP0);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: esp_cmprinitialize(%d) failed: %d\n",
+             ESPRESSIF_COMP0, ret);
+    }
+#endif
+
   /* If we got here then perhaps not all initialization was successful, but
    * at least enough succeeded to bring-up NSH with perhaps reduced
    * capabilities.
diff --git 
a/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/analog_cmpr/defconfig 
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/analog_cmpr/defconfig
new file mode 100644
index 00000000000..c0e7d8c57dc
--- /dev/null
+++ 
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/analog_cmpr/defconfig
@@ -0,0 +1,48 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="risc-v"
+CONFIG_ARCH_BOARD="esp32p4-function-ev-board"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32P4_FUNCTION_EV_BOARD=y
+CONFIG_ARCH_CHIP="esp32p4"
+CONFIG_ARCH_CHIP_ESP32P4=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_IRQ_TO_NDX=y
+CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
+CONFIG_ARCH_NUSER_INTERRUPTS=17
+CONFIG_ARCH_RISCV=y
+CONFIG_BOARDCTL_RESET=y
+CONFIG_BOARD_LOOPSPERMSEC=15000
+CONFIG_BUILTIN=y
+CONFIG_ESPRESSIF_ANA_COMPR0=y
+CONFIG_EXPERIMENTAL=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_NSH_STRERROR=y
+CONFIG_PREALLOC_TIMERS=0
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_BACKTRACE=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=29
+CONFIG_START_MONTH=11
+CONFIG_START_YEAR=2019
+CONFIG_SYSTEM_DUMPSTACK=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TESTING_GETPRIME=y
+CONFIG_TESTING_OSTEST=y
+CONFIG_UART0_SERIAL_CONSOLE=y
diff --git 
a/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_bringup.c 
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_bringup.c
index d11a942b726..5ba5cb3b48d 100644
--- a/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_bringup.c
+++ b/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_bringup.c
@@ -121,6 +121,10 @@
 #  include "espressif/esp_sdm.h"
 #endif
 
+#ifdef CONFIG_COMP
+#  include "espressif/esp_ana_cmpr.h"
+#endif
+
 #ifdef CONFIG_ESPRESSIF_USE_LP_CORE
 #  include "espressif/esp_ulp.h"
 #  ifdef CONFIG_ESPRESSIF_ULP_USE_TEST_BIN
@@ -470,6 +474,24 @@ int esp_bringup(void)
     }
 #endif
 
+#ifdef CONFIG_ESPRESSIF_ANA_COMPR0
+  ret = esp_cmprinitialize(ESPRESSIF_COMP0);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: esp_cmprinitialize(%d) failed: %d\n",
+             ESPRESSIF_COMP0, ret);
+    }
+#endif
+
+#ifdef CONFIG_ESPRESSIF_ANA_COMPR1
+  ret = esp_cmprinitialize(ESPRESSIF_COMP1);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: esp_cmprinitialize(%d) failed: %d\n",
+             ESPRESSIF_COMP1, ret);
+    }
+#endif
+
 #ifdef CONFIG_ESPRESSIF_EMAC
   ret = board_emac_init();
   if (ret < 0)

Reply via email to