mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
drivers/led: Let board_userled_initialize return the led number
so the lower half driver don't need include the specific board.h Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Icf6638a6865bac42150b5957376e55909f041d40
This commit is contained in:
committed by
Abdelatif Guettouche
parent
1ba1c34b01
commit
76965474ac
@@ -46,9 +46,6 @@
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/leds/userled.h>
|
||||
|
||||
#undef __KERNEL__
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#if CONFIG_USERLED_LOWER
|
||||
|
||||
/****************************************************************************
|
||||
@@ -66,6 +63,8 @@ static void userled_ledset(FAR const struct userled_lowerhalf_s *lower,
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t g_lednum;
|
||||
|
||||
/* This is the user LED lower half driver interface */
|
||||
|
||||
static const struct userled_lowerhalf_s g_userled_lower =
|
||||
@@ -90,8 +89,8 @@ static const struct userled_lowerhalf_s g_userled_lower =
|
||||
static userled_set_t
|
||||
userled_supported(FAR const struct userled_lowerhalf_s *lower)
|
||||
{
|
||||
ledinfo("BOARD_NLEDS: %02x\n", BOARD_NLEDS);
|
||||
return (userled_set_t)((1 << BOARD_NLEDS) - 1);
|
||||
ledinfo("BOARD_NLEDS: %02x\n", g_lednum);
|
||||
return (userled_set_t)((1 << g_lednum) - 1);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -137,7 +136,7 @@ static void userled_ledset(FAR const struct userled_lowerhalf_s *lower,
|
||||
|
||||
int userled_lower_initialize(FAR const char *devname)
|
||||
{
|
||||
board_userled_initialize();
|
||||
g_lednum = board_userled_initialize();
|
||||
return userled_register(devname, &g_userled_lower);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user