diff options
Diffstat (limited to 'nuttx/configs/mcu123-lpc214x/src')
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/src/up_leds.c | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/nuttx/configs/mcu123-lpc214x/src/up_leds.c b/nuttx/configs/mcu123-lpc214x/src/up_leds.c index e6744c547..8c465a055 100644 --- a/nuttx/configs/mcu123-lpc214x/src/up_leds.c +++ b/nuttx/configs/mcu123-lpc214x/src/up_leds.c @@ -1,7 +1,7 @@ -/************************************************************ - * board/up_leds.c +/**************************************************************************** + * configs/mcu123-lpc214x/src/up_leds.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,54 +31,72 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <nuttx/config.h> #include <sys/types.h> + +#include "chip.h" +#include "up_arch.h" #include "up_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ + +/* P1.16-P1.23 control LEDS 1-8 */ + +#define LEDBIT(led) (0x00010000 << (led)) +#define ALLLEDS (0x00ff0000) -/************************************************************ +#define putled(v,r) putreg32((v),(LPC214X_GPIO1_BASE+(r))) +#define CLRLEDS putled(ALLLEDS,LPC214X_GPIO_SET_OFFSET) + +/**************************************************************************** * Private Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Funtions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Name: up_ledinit - ************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void up_ledinit(void) { + /* Initilize GIOs P1.16-P1.23 */ + + putled(ALLLEDS,LPC214X_GPIO_DIR_OFFSET); + putled(ALLLEDS,LPC214X_GPIO_SET_OFFSET); + putled(LEDBIT(0),LPC214X_GPIO_CLR_OFFSET); } -/************************************************************ +/**************************************************************************** * Name: up_ledon - ************************************************************/ + ****************************************************************************/ void up_ledon(int led) { + putled(LEDBIT(led),LPC214X_GPIO_CLR_OFFSET); } -/************************************************************ +/**************************************************************************** * Name: up_ledoff - ************************************************************/ + ****************************************************************************/ void up_ledoff(int led) { + putled(LEDBIT(led),LPC214X_GPIO_SET_OFFSET); } #endif /* CONFIG_ARCH_LEDS */ |