Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boards/xtensa/esp32/heltec_wifi_lora32/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
/* Define how many LEDs this board has (needed by userleds) */

#define BOARD_NLEDS 1
#define GPIO_LED1 25 /* White LED on Heltec WiFi LoRa 32 */

/* GPIO pins used by the GPIO Subsystem */

Expand Down
3 changes: 3 additions & 0 deletions boards/xtensa/esp32/heltec_wifi_lora32/src/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ DEPPATH += --dep-path board
VPATH += :board
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board

ifeq ($(CONFIG_USERLED),y)
CSRCS += esp32_userleds.c
endif
14 changes: 13 additions & 1 deletion boards/xtensa/esp32/heltec_wifi_lora32/src/esp32_bringup.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <nuttx/debug.h>
#include <errno.h>
#include <nuttx/debug.h>
#include <nuttx/board.h>

#ifdef CONFIG_USERLED
# include <nuttx/leds/userled.h>
#endif

#include "esp32_start.h"

#ifdef CONFIG_ESPRESSIF_HR_TIMER
Expand Down Expand Up @@ -107,6 +111,14 @@ int esp32_bringup(void)
* capabilities.
*/

#ifdef CONFIG_USERLED
ret = userled_lower_initialize("/dev/userleds");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
}
#endif

UNUSED(ret);
return OK;
}
90 changes: 90 additions & 0 deletions boards/xtensa/esp32/heltec_wifi_lora32/src/esp32_userleds.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/****************************************************************************
* boards/xtensa/esp32/heltec_wifi_lora32/src/esp32_userleds.c
*
* SPDX-License-Identifier: Apache-2.0
*
* 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 <stdbool.h>

#include <nuttx/board.h>
#include <arch/board/board.h>

#include "espressif/esp_gpio.h"
#include "heltec_wifi_lora32.h"

/****************************************************************************
* Private Data
****************************************************************************/

static const uint32_t g_ledcfg[BOARD_NLEDS] =
{
GPIO_LED1,
};

/****************************************************************************
* Public Functions
****************************************************************************/

/****************************************************************************
* Name: board_userled_initialize
****************************************************************************/

uint32_t board_userled_initialize(void)
{
int i;

for (i = 0; i < BOARD_NLEDS; i++)
{
esp_configgpio(g_ledcfg[i], OUTPUT);
}

return BOARD_NLEDS;
}

/****************************************************************************
* Name: board_userled
****************************************************************************/

void board_userled(int led, bool ledon)
{
if ((unsigned int)led < BOARD_NLEDS)
{
esp_gpiowrite(g_ledcfg[led], ledon);
}
}

/****************************************************************************
* Name: board_userled_all
****************************************************************************/

void board_userled_all(uint32_t ledset)
{
int i;

for (i = 0; i < BOARD_NLEDS; i++)
{
esp_gpiowrite(g_ledcfg[i], (ledset & (1 << i)) != 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@

#define BUTTON_BOOT 0

/* LED
*
* This is an externally connected LED used for testing.
*/

#define GPIO_LED1 2

Check failure on line 49 in boards/xtensa/esp32/heltec_wifi_lora32/src/heltec_wifi_lora32.h

View workflow job for this annotation

GitHub Actions / check

Too many blank lines
/* PCNT Quadrature Encoder IDs */

#define PCNT_QE0_ID 0
Expand Down
Loading