From c22fe7b117110cd80469df672f7ab21c07702235 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 8 May 2009 13:24:57 +0000 Subject: [PATCH] Add logic to control LED git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1763 42af7a65-404d-4744-a932-0658087f49c3 --- configs/eagle100/README.txt | 2 ++ configs/eagle100/include/board.h | 2 +- configs/eagle100/ostest/defconfig | 2 ++ configs/eagle100/src/up_leds.c | 42 ++++++++++++++++++++++++++++--- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/configs/eagle100/README.txt b/configs/eagle100/README.txt index 27a725cf97..eefd0e18a3 100644 --- a/configs/eagle100/README.txt +++ b/configs/eagle100/README.txt @@ -94,6 +94,8 @@ Eagle100-specific Configuration Options CONFIG_ARCH_BOOTLOADER - Configure to use the MicroMint Eagle-100 Ethernet bootloader. + CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture. + LM3S6818 specific device driver settings CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the diff --git a/configs/eagle100/include/board.h b/configs/eagle100/include/board.h index 855c011760..e08d7af83a 100644 --- a/configs/eagle100/include/board.h +++ b/configs/eagle100/include/board.h @@ -55,7 +55,7 @@ /* LED definitions ******************************************************************/ -/* The Eagle-100 has only one user LED: Port A, Bit 6. Below are the mapping of this +/* The Eagle-100 has only one user LED: Port E, Bit 1. Below is the mapping of this * single LED. From this single LED, we can get the following information: * * OFF Steady: The system has failed to boot to the point of enabling interrupts diff --git a/configs/eagle100/ostest/defconfig b/configs/eagle100/ostest/defconfig index 658d90989d..d88d1e9244 100644 --- a/configs/eagle100/ostest/defconfig +++ b/configs/eagle100/ostest/defconfig @@ -56,6 +56,7 @@ # CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions # CONFIG_ARCH_BOOTLOADER - Configure to use the MicroMint Eagle-100 # Ethernet bootloader. +# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture. CONFIG_ARCH=arm CONFIG_ARCH_ARM=y CONFIG_ARCH_CHIP=lm3s @@ -69,6 +70,7 @@ CONFIG_DRAM_NUTTXENTRY=0x00002000 CONFIG_ARCH_INTERRUPTSTACK=n CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_BOOTLOADER=y +CONFIG_ARCH_LEDS=y # # LM3S6918 specific serial device driver settings diff --git a/configs/eagle100/src/up_leds.c b/configs/eagle100/src/up_leds.c index 4fff52f625..2b8dcfb6b2 100644 --- a/configs/eagle100/src/up_leds.c +++ b/configs/eagle100/src/up_leds.c @@ -40,6 +40,11 @@ #include #include + +#include + +#include "chip.h" +#include "up_arch.h" #include "up_internal.h" /**************************************************************************** @@ -65,9 +70,9 @@ #ifdef CONFIG_ARCH_LEDS void up_ledinit(void) { - /* Configure Port A, Bit 6 as an output, initial value=OFF */ + /* Configure Port E, Bit 1 as an output, initial value=OFF */ -#warning "Missing Logic" + lm3s_configgpio(GPIO_DIR_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | 1); } /**************************************************************************** @@ -76,7 +81,21 @@ void up_ledinit(void) void up_ledon(int led) { -#warning "Missing Logic" + switch (led) + { + case LED_STARTED: + case LED_HEAPALLOCATE: + default: + break; + case LED_IRQSENABLED: + case LED_STACKCREATED: + case LED_INIRQ: + case LED_SIGNAL: + case LED_ASSERTION: + case LED_PANIC: + modifyreg32(LM3S_GPIOE_DATA, 0, (1 << 1)); + break; + } } /**************************************************************************** @@ -85,7 +104,22 @@ void up_ledon(int led) void up_ledoff(int led) { -#warning "Missing Logic" + switch (led) + { + case LED_IRQSENABLED: + case LED_STACKCREATED: + default: + break; + + case LED_STARTED: + case LED_HEAPALLOCATE: + case LED_INIRQ: + case LED_SIGNAL: + case LED_ASSERTION: + case LED_PANIC: + modifyreg32(LM3S_GPIOE_DATA, (1 << 1), 0); + break; + } } #endif /* CONFIG_ARCH_LEDS */