drivers: Move discrete user LED drivrs from drivers/discrete to drivers/leds

This commit is contained in:
Gregory Nutt 2015-12-15 08:23:53 -06:00
parent d62a626703
commit 78f2ce05f8
9 changed files with 59 additions and 60 deletions

View File

@ -11049,13 +11049,10 @@
* Many files: Standardize naming of the user LED interface functions.
The new user LED interface functions are now prototyped in only in
include/nuttx/board.h and have name like board_userled_* (2015-11-01).
* Rename ioexpander/ directories to discrete/. This expands the
namespace so that other discrete I/O drivers can reside there as
well (2015-11-01).
* drivers/discrete/userled_upper.c and include/discrete/userled.h: Add
* drivers/leds/usersled_upper.c and include/leds/usersled.h: Add
a generic character driver that may be used by applications to write
to board LEDs (2015-11-01).
* drivers/discrete/userled_lower.c: Add a generic lower-half user LED
* drivers/leds/usersled_lower.c: Add a generic lower-half user LED
driver that may be used by any board that supports the standard
board user LED interfaces (2015-11-01).
* sched/clock: Fix error in clock_timespec_subtract(). Found by Lok
@ -11245,4 +11242,3 @@
* drivers/led: Adds a driver for the PCA9635PW I2C LED driver IC which
can be used to control the intensity of up to 16 LEDs. From Alexander
Entinger (2015-12-15).

View File

@ -50,39 +50,3 @@ config IOEXPANDER_MULTIPIN
optimized simultaneous access to multiple pins.
endif # IOEXPANDER
config USERLED
bool "LED driver"
default n
depends on ARCH_HAVE_LEDS
---help---
Enable standard user LED upper half driver.
if USERLED
config USERLED_LOWER
bool "Generic Lower Half LED Driver"
default n
---help---
If the board supports the standard LED interfaces as
defined in include/nuttx/board.h header file, then this
standard LED lower half driver might be usable.
In order for this generic driver to be usable:
1. The board implementation must provide the LED
interfaces as defined in include/nuttx/board.h
2. The board.h header file must provide the definition
BOARD_NLEDS, and
3. The board.h header file must not include any other
header files that are not accessibble in this context
(such as those in arch/<arch>/src/<chip>) UNLESS those
inclusions are conditioned on __KERNEL__. button_lower.c
will undefine __KERNEL__ before included board.h.
If your board does not meet these requirements, then the
userled_lower.c file can still be copied to your your
board src/ directory and modified for your specific board
requirements.
endif # USERLED

View File

@ -37,15 +37,6 @@
ifeq ($(CONFIG_DISCRETE_IO),y)
# Include user LED driver
ifeq ($(CONFIG_USERLED),y)
CSRCS += userled_upper.c
ifeq ($(CONFIG_USERLED_LOWER),y)
CSRCS += userled_lower.c
endif
endif
# Include buttion driver
# Although it makes sense for button drivers to be in the discrete driver
# directory, the button drivers current reside in the input dirver directory.

View File

@ -5,6 +5,42 @@
menu "LED Support"
config USERLED
bool "LED driver"
default n
depends on ARCH_HAVE_LEDS
---help---
Enable standard user LED upper half driver.
if USERLED
config USERLED_LOWER
bool "Generic Lower Half LED Driver"
default n
---help---
If the board supports the standard LED interfaces as
defined in include/nuttx/board.h header file, then this
standard LED lower half driver might be usable.
In order for this generic driver to be usable:
1. The board implementation must provide the LED
interfaces as defined in include/nuttx/board.h
2. The board.h header file must provide the definition
BOARD_NLEDS, and
3. The board.h header file must not include any other
header files that are not accessibble in this context
(such as those in arch/<arch>/src/<chip>) UNLESS those
inclusions are conditioned on __KERNEL__. button_lower.c
will undefine __KERNEL__ before included board.h.
If your board does not meet these requirements, then the
userled_lower.c file can still be copied to your your
board src/ directory and modified for your specific board
requirements.
endif # USERLED
config PCA9635PW
bool "PCA9635PW I2C LED Driver"
default n

View File

@ -39,6 +39,17 @@
LEDDEPATH =
LEDVPATH =
# Include user LED driver
ifeq ($(CONFIG_USERLED),y)
CSRCS += userled_upper.c
ifeq ($(CONFIG_USERLED_LOWER),y)
CSRCS += userled_lower.c
endif
LEDDEPATH = --dep-path leds
LEDVPATH = :leds
endif
ifeq ($(CONFIG_PCA9635PW),y)
CSRCS += pca9635pw.c
LEDDEPATH = --dep-path leds

View File

@ -1,5 +1,5 @@
/****************************************************************************
* drivers/discrete/userled_lower.c
* drivers/leds/userled_lower.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -44,7 +44,7 @@
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/discrete/userled.h>
#include <nuttx/leds/userled.h>
#undef __KERNEL__
#include <arch/board/board.h>
@ -57,6 +57,7 @@
static userled_set_t userled_supported(FAR const struct userled_lowerhalf_s *lower);
static void userled_led(FAR const struct userled_lowerhalf_s *lower,
int led, bool ledon);
static void userled_ledset(FAR const struct userled_lowerhalf_s *lower,
userled_set_t ledset);

View File

@ -1,5 +1,5 @@
/****************************************************************************
* drivers/discrete/userled_upper.c
* drivers/leds/userled_upper.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -54,7 +54,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include <nuttx/discrete/userled.h>
#include <nuttx/leds/userled.h>
/****************************************************************************
* Pre-processor Definitions

View File

@ -350,7 +350,7 @@
#define _BTNIOC(nr) _IOC(_BTNBASE,nr)
/* User LED driver ioctl definitions ****************************************/
/* (see nuttx/discrete/userled.h */
/* (see nuttx/leds/usersled.h */
#define _ULEDIOCVALID(c) (_IOC_TYPE(c)==_ULEDBASE)
#define _ULEDIOC(nr) _IOC(_ULEDBASE,nr)

View File

@ -1,5 +1,5 @@
/************************************************************************************
* include/nuttx/input/userled.h
* include/nuttx/leds/userled.h
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -33,8 +33,8 @@
*
************************************************************************************/
#ifndef __INCLUDE_NUTTX_DISCRETE_USERLED_H
#define __INCLUDE_NUTTX_DISCRETE_USERLED_H
#ifndef __INCLUDE_NUTTX_LEDS_USERLED_H
#define __INCLUDE_NUTTX_LEDS_USERLED_H
/****************************************************************************
* Included Files
@ -198,4 +198,4 @@ int userled_lower_initialize(FAR const char *devname);
#endif
#endif /* CONFIG_ARCH_HAVE_LEDS */
#endif /* __INCLUDE_NUTTX_DISCRETE_USERLED_H */
#endif /* __INCLUDE_NUTTX_LEDS_USERLED_H */