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

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


The following commit(s) were added to refs/heads/master by this push:
     new 150854c6f2 ESP_PCNT: add high and low limit Kconfig options
150854c6f2 is described below

commit 150854c6f24c5cd0fd6abd08aeece3b2c8f1f576
Author: Martin Vajnar <martin.vaj...@gmail.com>
AuthorDate: Sat Jul 19 16:53:19 2025 +0200

    ESP_PCNT: add high and low limit Kconfig options
    
    Signed-off-by: Martin Vajnar <martin.vaj...@gmail.com>
---
 arch/risc-v/src/common/espressif/Kconfig              | 16 ++++++++++++++++
 arch/xtensa/src/common/espressif/Kconfig              | 16 ++++++++++++++++
 boards/risc-v/esp32c6/common/src/esp_board_pcnt.c     |  4 ++--
 boards/risc-v/esp32h2/common/src/esp_board_pcnt.c     |  4 ++--
 boards/xtensa/esp32/common/src/esp32_board_pcnt.c     |  4 ++--
 boards/xtensa/esp32s2/common/src/esp32s2_board_pcnt.c |  4 ++--
 boards/xtensa/esp32s3/common/src/esp32s3_board_pcnt.c |  4 ++--
 7 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/arch/risc-v/src/common/espressif/Kconfig 
b/arch/risc-v/src/common/espressif/Kconfig
index 41e4051c9c..000c78794f 100644
--- a/arch/risc-v/src/common/espressif/Kconfig
+++ b/arch/risc-v/src/common/espressif/Kconfig
@@ -682,6 +682,22 @@ config ESP_PCNT_TEST_MODE
                to the receiver internally, being able to test the PCNT
                peripheral without any external connection.
 
+config ESP_PCNT_HIGH_LIMIT
+       int "PCNT high limit value"
+       default 1024
+       range 1 32767
+       ---help---
+               This sets thr_h_lim value for all units. When pulse_cnt reaches
+               this value, the counter will be cleared.
+
+config ESP_PCNT_LOW_LIMIT
+       int "PCNT low limit value"
+       default -1024
+       range -32768 -1
+       ---help---
+               This sets thr_l_lim value for all units. When pulse_cnt reaches
+               this value, the counter will be cleared.
+
 config ESP_PCNT_AS_QE
        bool
        default n
diff --git a/arch/xtensa/src/common/espressif/Kconfig 
b/arch/xtensa/src/common/espressif/Kconfig
index f1e8906b73..3f8768777d 100644
--- a/arch/xtensa/src/common/espressif/Kconfig
+++ b/arch/xtensa/src/common/espressif/Kconfig
@@ -348,6 +348,22 @@ config ESP_PCNT_TEST_MODE
                to the receiver internally, being able to test the PCNT
                peripheral without any external connection.
 
+config ESP_PCNT_HIGH_LIMIT
+       int "PCNT high limit value"
+       default 1024
+       range 1 32767
+       ---help---
+               This sets thr_h_lim value for all units. When pulse_cnt reaches
+               this value, the counter will be cleared.
+
+config ESP_PCNT_LOW_LIMIT
+       int "PCNT low limit value"
+       default -1024
+       range -32768 -1
+       ---help---
+               This sets thr_l_lim value for all units. When pulse_cnt reaches
+               this value, the counter will be cleared.
+
 config ESP_PCNT_AS_QE
        bool
        default n
diff --git a/boards/risc-v/esp32c6/common/src/esp_board_pcnt.c 
b/boards/risc-v/esp32c6/common/src/esp_board_pcnt.c
index c8d50ae4b0..efba728663 100644
--- a/boards/risc-v/esp32c6/common/src/esp_board_pcnt.c
+++ b/boards/risc-v/esp32c6/common/src/esp_board_pcnt.c
@@ -41,8 +41,8 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define PCNT_HIGH_LIMIT 1000
-#define PCNT_LOW_LIMIT  -1000
+#define PCNT_HIGH_LIMIT CONFIG_ESP_PCNT_HIGH_LIMIT
+#define PCNT_LOW_LIMIT  CONFIG_ESP_PCNT_LOW_LIMIT
 
 #define PCNT_GLITCH_FILTER(pcnt, thres) pcnt->ops->ioctl(pcnt,          \
                                                          CAPIOC_FILTER, \
diff --git a/boards/risc-v/esp32h2/common/src/esp_board_pcnt.c 
b/boards/risc-v/esp32h2/common/src/esp_board_pcnt.c
index bfa5620208..283a3ced3e 100644
--- a/boards/risc-v/esp32h2/common/src/esp_board_pcnt.c
+++ b/boards/risc-v/esp32h2/common/src/esp_board_pcnt.c
@@ -41,8 +41,8 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define PCNT_HIGH_LIMIT 1000
-#define PCNT_LOW_LIMIT  -1000
+#define PCNT_HIGH_LIMIT CONFIG_ESP_PCNT_HIGH_LIMIT
+#define PCNT_LOW_LIMIT  CONFIG_ESP_PCNT_LOW_LIMIT
 
 #define PCNT_GLITCH_FILTER(pcnt, thres) pcnt->ops->ioctl(pcnt,          \
                                                          CAPIOC_FILTER, \
diff --git a/boards/xtensa/esp32/common/src/esp32_board_pcnt.c 
b/boards/xtensa/esp32/common/src/esp32_board_pcnt.c
index 018d23216e..778ed99157 100644
--- a/boards/xtensa/esp32/common/src/esp32_board_pcnt.c
+++ b/boards/xtensa/esp32/common/src/esp32_board_pcnt.c
@@ -40,8 +40,8 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define PCNT_HIGH_LIMIT 1000
-#define PCNT_LOW_LIMIT  -1000
+#define PCNT_HIGH_LIMIT CONFIG_ESP_PCNT_HIGH_LIMIT
+#define PCNT_LOW_LIMIT  CONFIG_ESP_PCNT_LOW_LIMIT
 
 #define PCNT_GLITCH_FILTER(pcnt, thres) pcnt->ops->ioctl(pcnt,          \
                                                          CAPIOC_FILTER, \
diff --git a/boards/xtensa/esp32s2/common/src/esp32s2_board_pcnt.c 
b/boards/xtensa/esp32s2/common/src/esp32s2_board_pcnt.c
index cbd7c49b78..b02fb0c7c9 100644
--- a/boards/xtensa/esp32s2/common/src/esp32s2_board_pcnt.c
+++ b/boards/xtensa/esp32s2/common/src/esp32s2_board_pcnt.c
@@ -40,8 +40,8 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define PCNT_HIGH_LIMIT 1000
-#define PCNT_LOW_LIMIT  -1000
+#define PCNT_HIGH_LIMIT CONFIG_ESP_PCNT_HIGH_LIMIT
+#define PCNT_LOW_LIMIT  CONFIG_ESP_PCNT_LOW_LIMIT
 
 #define PCNT_GLITCH_FILTER(pcnt, thres) pcnt->ops->ioctl(pcnt,          \
                                                          CAPIOC_FILTER, \
diff --git a/boards/xtensa/esp32s3/common/src/esp32s3_board_pcnt.c 
b/boards/xtensa/esp32s3/common/src/esp32s3_board_pcnt.c
index 47621db8e4..f1a2277382 100644
--- a/boards/xtensa/esp32s3/common/src/esp32s3_board_pcnt.c
+++ b/boards/xtensa/esp32s3/common/src/esp32s3_board_pcnt.c
@@ -40,8 +40,8 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define PCNT_HIGH_LIMIT 1000
-#define PCNT_LOW_LIMIT  -1000
+#define PCNT_HIGH_LIMIT CONFIG_ESP_PCNT_HIGH_LIMIT
+#define PCNT_LOW_LIMIT  CONFIG_ESP_PCNT_LOW_LIMIT
 
 #define PCNT_GLITCH_FILTER(pcnt, thres) pcnt->ops->ioctl(pcnt,          \
                                                          CAPIOC_FILTER, \

Reply via email to