add support to q-enconder

This commit is contained in:
halyssonJr 2023-11-20 13:54:50 -03:00 committed by Xiang Xiao
parent 1cb879773a
commit bc64559bac
2 changed files with 30 additions and 11 deletions

View File

@ -37,6 +37,19 @@
#define BUTTON_BOOT 0
/* LED
*
* This is the external RGB LED.
*/
#define GPIO_LED_RED 17
#define GPIO_LED_GREEN 4
#define GPIO_LED_BLUE 16
/* PCNT Quadrature Encoder IDs */
#define PCNT_QE0_ID 0
/* TIMERS */
#define TIMER0 0

View File

@ -64,6 +64,10 @@
# include "esp32_board_wlan.h"
#endif
#ifdef CONFIG_ESP32_PCNT_AS_QE
# include "board_qencoder.h"
#endif
#ifdef CONFIG_ESP32_RT_TIMER
# include "esp32_rt_timer.h"
#endif
@ -300,17 +304,6 @@ int esp32_bringup(void)
#endif
#ifdef CONFIG_SENSORS_BMP180
/* Try to register BMP180 device in I2C0 */
ret = board_bmp180_initialize(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize BMP180 driver: %d\n", ret);
}
#endif
#ifdef CONFIG_INPUT_BUTTONS
/* Register the BUTTON driver */
@ -349,6 +342,19 @@ int esp32_bringup(void)
}
#endif
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
ret = board_qencoder_initialize(0, PCNT_QE0_ID);
if (ret != OK)
{
syslog(LOG_ERR,
"ERROR: Failed to register the qencoder: %d\n",
ret);
return ret;
}
#endif
#ifdef CONFIG_RTC_DRIVER
/* Instantiate the ESP32 RTC driver */