fix: Correct issues with userled support on the Nucleo F4x1RE.
Remove space following left parenthesis. Add space after comment. Update stm32_bringup.c
This commit is contained in:
parent
5ac469441e
commit
fd9ef2f6a2
@ -37,6 +37,10 @@
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#include "nucleo-f4x1re.h"
|
||||
|
||||
#include <nuttx/board.h>
|
||||
@ -45,6 +49,17 @@
|
||||
#include "board_qencoder.h"
|
||||
#endif
|
||||
|
||||
#undef HAVE_LEDS
|
||||
#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
|
||||
# define HAVE_LEDS 1
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LEDS_DEVPATH
|
||||
# define LED_DRIVER_PATH CONFIG_EXAMPLES_LEDS_DEVPATH
|
||||
#else
|
||||
# define LED_DRIVER_PATH "/dev/userleds"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -67,6 +82,17 @@ int stm32_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef HAVE_LEDS
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize(LED_DRIVER_PATH);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure SPI-based devices */
|
||||
|
||||
#ifdef CONFIG_STM32_SPI1
|
||||
|
@ -164,7 +164,7 @@ uint32_t board_userled_initialize(void)
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if (led == 1)
|
||||
if (BOARD_LD2_BIT == (1 << led))
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD2, ledon);
|
||||
}
|
||||
@ -176,9 +176,29 @@ void board_userled(int led, bool ledon)
|
||||
|
||||
void board_userled_all(uint32_t ledset)
|
||||
{
|
||||
/* An output of '1' illuminates the LED */
|
||||
|
||||
stm32_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERLED_LOWER_READSTATE
|
||||
/****************************************************************************
|
||||
* Name: board_userled_getall
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_getall(uint32_t *ledset)
|
||||
{
|
||||
/* Clear the LED bits */
|
||||
|
||||
*ledset = 0;
|
||||
|
||||
/* Get LED state. An output of '1' illuminates the LED. */
|
||||
|
||||
*ledset |= ((stm32_gpioread(GPIO_LD2) & 1) << BOARD_LD2);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USERLED_LOWER_READSTATE */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_led_pminitialize
|
||||
****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user