summaryrefslogtreecommitdiff
path: root/nuttx/configs/mcu123-lpc214x/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-17 18:44:34 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-17 18:44:34 +0000
commit2329a560c03845b21f525cf269106bae13b1039e (patch)
treeb0219411a526eb8b4de118a978a0ee6bb31ac67d /nuttx/configs/mcu123-lpc214x/src
parent7fd98a9d90f01172ce456487219ce9e10814fafc (diff)
downloadpx4-nuttx-2329a560c03845b21f525cf269106bae13b1039e.tar.gz
px4-nuttx-2329a560c03845b21f525cf269106bae13b1039e.tar.bz2
px4-nuttx-2329a560c03845b21f525cf269106bae13b1039e.zip
Update lpc214x stuff
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@923 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/mcu123-lpc214x/src')
-rw-r--r--nuttx/configs/mcu123-lpc214x/src/up_leds.c60
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 */