boards/xtensa/esp32: Move the LED definition to the private header and
remove userleds for boards that don't have that. Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
parent
f7c5b467e1
commit
c95aba84f1
@ -203,7 +203,6 @@ config ARCH_BOARD_ESP32_DEVKITC
|
||||
config ARCH_BOARD_ESP32_ETHERNETKIT
|
||||
bool "Espressif ESP32 Ethernet Kit"
|
||||
depends on ARCH_CHIP_ESP32
|
||||
select ARCH_HAVE_LEDS
|
||||
---help---
|
||||
The ESP32-Ethernet-Kit is an Ethernet-to-Wi-Fi development board that enables
|
||||
Ethernet devices to be interconnected over Wi-Fi. At the same time, to provide
|
||||
|
@ -90,6 +90,5 @@
|
||||
/* Define how many LEDs this board has (needed by userleds) */
|
||||
|
||||
#define BOARD_NLEDS 1
|
||||
#define GPIO_LED1 2
|
||||
|
||||
#endif /* __BOARDS_XTENSA_ESP32_ESP32_CORE_INCLUDE_BOARD_H */
|
||||
|
@ -48,6 +48,15 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* GPIO Pin Definitions *****************************************************/
|
||||
|
||||
/* LED
|
||||
*
|
||||
* This is an externally connected LED used for testing.
|
||||
*/
|
||||
|
||||
#define GPIO_LED1 2
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -27,9 +27,11 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
#include <arch/board/board.h>
|
||||
#include "esp32_gpio.h"
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "esp32_gpio.h"
|
||||
#include "esp32-devkitc.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -72,11 +72,4 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* Define how many LEDs this board has (needed by userleds) */
|
||||
|
||||
#define BOARD_NLEDS 1
|
||||
#define GPIO_LED1 2
|
||||
|
||||
#endif /* __BOARDS_XTENSA_ESP32_ESP32_ETHERNET_KIT_INCLUDE_BOARD_H */
|
||||
|
@ -45,10 +45,6 @@ ifeq ($(CONFIG_ESP32_SPIFLASH),y)
|
||||
CSRCS += esp32_spiflash.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USERLED),y)
|
||||
CSRCS += esp32_userleds.c
|
||||
endif
|
||||
|
||||
SCRIPTIN = $(SCRIPTDIR)$(DELIM)esp32.template.ld
|
||||
SCRIPTOUT = $(SCRIPTDIR)$(DELIM)esp32_out.ld
|
||||
|
||||
|
@ -1,93 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_userleds.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
#include <arch/board/board.h>
|
||||
#include "esp32_gpio.h"
|
||||
|
||||
#include "esp32-ethernet-kit.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This array maps an LED number to GPIO pin configuration */
|
||||
|
||||
static const uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||
{
|
||||
GPIO_LED1,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_userled_initialize(void)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < BOARD_NLEDS; i++)
|
||||
{
|
||||
esp32_configgpio(g_ledcfg[i], OUTPUT);
|
||||
}
|
||||
|
||||
return BOARD_NLEDS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if ((unsigned)led < BOARD_NLEDS)
|
||||
{
|
||||
esp32_gpiowrite(g_ledcfg[led], ledon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint32_t ledset)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
/* Configure LED1-8 GPIOs for output */
|
||||
|
||||
for (i = 0; i < BOARD_NLEDS; i++)
|
||||
{
|
||||
esp32_gpiowrite(g_ledcfg[i], (ledset & (1 << i)) != 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user