eren-terzioglu opened a new pull request, #18926:
URL: https://github.com/apache/nuttx/pull/18926

   ## Summary
   
   <!-- This field should contain a summary of the changes. It will be 
pre-filled with the commit's message and descriptions. Adjust it accordingly -->
   
   * Docs/platforms/risc-v: Add Analog Comparator docs for esp32[-h2|-p4]
   
   Add Analog Comparator docs for esp32h2 and esp32p4
   
   * boards/risc-v/espressif: Add Analog Comparator board support for 
esp32[-h2|-p4]
   
   Add Analog Comparator board support for esp32p4 and esp32h2
   
   * arch/risc-v/espressif: Add Analog Comparator for esp32[-h2|-p4]
   
   Add analog comparator support for esp32p4 and esp32h2
   
   ## Impact
   <!-- Please fill the following sections with YES/NO and provide a brief 
explanation -->
   
   Impact on user: Yes, analog comparator support added 
   <!-- Does it impact user's applications? How? -->
   
   Impact on build: No
   <!-- Does it impact on building NuttX? How? (please describe the required 
changes on the build system) -->
   
   Impact on hardware: Yes, analog comparator support added
   <!-- Does it impact a specific hardware supported by NuttX? -->
   
   Impact on documentation: Yes, related docs added
   <!-- Does it impact the existing documentation? Please provide additional 
documentation to reflect that -->
   
   Impact on security: No
   <!-- Does it impact NuttX's security? -->
   
   Impact on compatibility: No
   <!-- Does it impact compatibility between previous and current versions? Is 
this a breaking change? -->
   
   ## Testing
   <!-- Please provide all the testing procedure. Consider that upstream 
reviewers should be able to reproduce the same testing performed internally -->
   
   Config used:
   ```
   esp32p4-function-ev-board:analog_cmpr
   esp32h2-devkit:analog_cmpr
   ```
   
   With these options:
   ```
   CONFIG_DEBUG_ANALOG
   CONFIG_DEBUG_ANALOG_ERROR
   CONFIG_DEBUG_ANALOG_INFO
   CONFIG_DEBUG_ANALOG_WARN
   CONFIG_DEBUG_FEATURES
   ```
   
   
   ### Building
   <!-- Provide how to build the test for each SoC being tested -->
   
   Command to build:
   
   ```
   make -j distclean && ./tools/configure.sh 
esp32p4-function-ev-board:analog_cmpr && kconfig-tweak -e CONFIG_DEBUG_ANALOG 
&& kconfig-tweak -e CONFIG_DEBUG_ANALOG_ERROR && kconfig-tweak -e 
CONFIG_DEBUG_ANALOG_INFO && kconfig-tweak -e CONFIG_DEBUG_ANALOG_WARN && 
kconfig-tweak -e CONFIG_DEBUG_FEATURES && make olddefconfig && make 
ESPTOOL_BINDIR=./ -s -j
   ```
   
   ### Running
   <!-- Provide how to run the test for each SoC being tested -->
   
   SRC pin of comparator (GPIO52->P4 GPIO11->H2) connected to GND at first, 
after that pin connected to 3v3
   
   Snippet used to test is looking like this:
   
   ```
   #include <nuttx/config.h>
   #include <nuttx/analog/comp.h>
   #include <inttypes.h>
   #include <stdio.h>
   #include <fcntl.h>
   #include <unistd.h>
   #include <syslog.h>
   #include <sys/types.h>
   #include <sys/ioctl.h>
   #include <stdlib.h>
   #include <string.h>
   #include <errno.h>
   #include <debug.h>
   #include <driver/gpio.h>
   
   
   int main(int argc, FAR char *argv[])
   {
     int fd;
     int ret;
     int res;
   
     fd = open("/dev/anacmpr0", O_RDONLY);
   
     while(1)
       {
         ret = read(fd, &res, sizeof(res));
         if (ret != 0)
           {
              printf("Result: %ld\n", res);
           }
       }
     ret = read(fd, &res, sizeof(res));
   
     return OK;
   }
   
   ```
   
   ### Results
   <!-- Provide tests' results and runtime logs -->
   
   Output:
   
   ```
   Result: 0
   esp_ana_cmpr_callback: Comparator unit0: Positive cross event triggered
   Result: 1
   esp_ana_cmpr_callback: Comparator unit0: Negative cross event triggered
   Result: 0
   ```


-- 
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]

Reply via email to