boards/esp32-wrover-kit: Fix GPIO conflicts

This commit is contained in:
SuGliger 2022-11-25 15:04:17 -03:00 committed by Xiang Xiao
parent 9cdb865c9c
commit 83a4b45dd4
2 changed files with 47 additions and 4 deletions

View File

@ -53,11 +53,10 @@
#define BOARD_LED1 0
#define BOARD_LED2 1
#define BOARD_LED3 2
#define BOARD_NLEDS 3
#define BOARD_LED_RED BOARD_LED1
#define BOARD_LED_GREEN BOARD_LED2
#define BOARD_LED_BLUE BOARD_LED3
#define BOARD_LED_RED BOARD_LED1 /* GPIO 0 */
#define BOARD_LED_GREEN BOARD_LED2 /* GPIO 2 */
#define BOARD_LED_BLUE BOARD_LED3 /* GPIO 4 */
/* LED bits for use with autoleds */
@ -65,6 +64,29 @@
#define BOARD_LED2_BIT (1 << BOARD_LED2)
#define BOARD_LED3_BIT (1 << BOARD_LED3)
/* GPIO 2 is used by MMCSD driver as MISO, therefore, it can't be used as
* USER LED
*/
#ifdef CONFIG_MMCSD
/* GPIO 0 is used by BUTTONS, it can't be used as USER LED */
#ifdef CONFIG_INPUT_BUTTONS
# define BOARD_NLEDS 1
#else
# define BOARD_NLEDS 2
#endif
#else /* MMCSD */
/* GPIO 0 is used by BUTTONS, it can't be used as USER LED */
#ifdef CONFIG_INPUT_BUTTONS
# define BOARD_NLEDS 2
#else
# define BOARD_NLEDS 3
#endif
#endif
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 3 LEDs on
* board the ESP-WROVER-KIT. The following definitions describe how
* NuttX controls the LEDs:

View File

@ -42,7 +42,28 @@
static const uint32_t g_ledcfg[BOARD_NLEDS] =
{
/* GPIO 2 is used by MMCSD driver as MISO, therefore, it can't be used as
* USER LED
*/
#ifdef CONFIG_MMCSD
/* GPIO 0 is used by BUTTONS, it can't be used as USER LED */
#ifdef CONFIG_INPUT_BUTTONS
GPIO_LED3
#else
GPIO_LED1, GPIO_LED3
#endif
#else /* MMCSD */
/* GPIO 0 is used by BUTTONS, it can't be used as USER LED */
#ifdef CONFIG_INPUT_BUTTONS
GPIO_LED2, GPIO_LED3
#else
GPIO_LED1, GPIO_LED2, GPIO_LED3
#endif
#endif
};
/****************************************************************************