eren-terzioglu commented on code in PR #15079: URL: https://github.com/apache/nuttx/pull/15079#discussion_r1879757763
########## include/nuttx/pcnt/pcntchar.h: ########## @@ -20,80 +20,69 @@ * ****************************************************************************/ +#ifndef __INCLUDE_NUTTX_PCNT_PCNTCHAR_H +#define __INCLUDE_NUTTX_PCNT_PCNTCHAR_H + /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> -#include <errno.h> -#include <debug.h> -#include <stdio.h> +#include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> -#include <nuttx/sensors/qencoder.h> -#include <arch/board/board.h> +#include <nuttx/pcnt/pcnt.h> -#include "espressif/esp_qencoder.h" +#ifdef CONFIG_PCNTCHAR /**************************************************************************** - * Public Functions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** - * Name: board_qencoder_initialize - * - * Description: - * Initialize the quadrature encoder driver - * + * Public Types ****************************************************************************/ -int board_qencoder_initialize(void) -{ - int ret; - char devpath[12]; - int devno = 0; +/**************************************************************************** + * Public Data + ****************************************************************************/ - /* Initialize a quadrature encoder interface. */ -#ifdef CONFIG_ESP_PCNT_U0_QE - snprintf(devpath, sizeof(devpath), "/dev/qe%d", devno++); - ret = esp_qeinitialize(devpath, 0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: esp_qeinitialize failed: %d\n", ret); - return ret; - } +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern #endif -#ifdef CONFIG_ESP_PCNT_U1_QE - snprintf(devpath, sizeof(devpath), "/dev/qe%d", devno++); - ret = esp_qeinitialize(devpath, 1); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: esp_qeinitialize failed: %d\n", ret); - return ret; - } -#endif +/**************************************************************************** + * Public Functions Prototypes + ****************************************************************************/ -#ifdef CONFIG_ESP_PCNT_U2_QE - snprintf(devpath, sizeof(devpath), "/dev/qe%d", devno++); - ret = esp_qeinitialize(devpath, 2); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: esp_qeinitialize failed: %d\n", ret); - return ret; - } -#endif +/**************************************************************************** + * Name: pcntchar_register + * + * Description: + * Create and register the pulse counter (pcnt) character driver. + * + * Input Parameters: + * pcnt - An instance of the lower half pcnt driver + * + * Returned Value: + * OK if the driver was successfully registered; A negated errno value is + * returned on any failure. + * + ****************************************************************************/ -#ifdef CONFIG_ESP_PCNT_U3_QE - snprintf(devpath, sizeof(devpath), "/dev/qe%d", devno++); - ret = esp_qeinitialize(devpath, 3); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: esp_qeinitialize failed: %d\n", ret); - return ret; - } -#endif +int pcntchar_register(FAR struct pcnt_dev_s *pcnt); Review Comment: Up to you but we can keep it for now because this driver will be there for temporary. ########## drivers/Makefile: ########## @@ -55,6 +55,7 @@ include eeprom/Make.defs include efuse/Make.defs include net/Make.defs include note/Make.defs +include pcnt/Make.defs Review Comment: Up to you but we can keep it for now because this driver will be there for temporary. -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org