mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Fixe LM3S GPIO output settings; fix Eagle-100 LEDs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1823 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -114,7 +114,8 @@
|
||||
|
||||
/* GPIO for microSD card chip select */
|
||||
|
||||
#define SDC_CS (GPIO_PORTG | 2)
|
||||
#define SDCCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | GPIO_VALUE_ONE | GPIO_PORTG | 2)
|
||||
#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTE | 1)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
@@ -70,7 +72,7 @@ void lm3s_boardinitialize(void)
|
||||
{
|
||||
/* Configure the SPI-based microSD CS GPIO */
|
||||
|
||||
lm3s_configgpio(SDC_CS | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | GPIO_VALUE_ONE);
|
||||
lm3s_configgpio(SDCCS_GPIO);
|
||||
|
||||
/* Configure on-board LEDs */
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
@@ -52,6 +54,28 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Enables debug output from this file (needs CONFIG_DEBUG with
|
||||
* CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#undef LED_DEBUG /* Define to enable debug */
|
||||
|
||||
#ifdef LED_DEBUG
|
||||
# define leddbg lldbg
|
||||
# define ledvdbg llvdbg
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/* Dump GPIO registers */
|
||||
|
||||
#ifdef LED_DEBUG
|
||||
# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m)
|
||||
#else
|
||||
# define led_dumpgpio(m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@@ -73,13 +97,13 @@ static boolean g_nest;
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
void up_ledinit(void)
|
||||
{
|
||||
/* Make sure that the GPIOE peripheral is enabled */
|
||||
|
||||
modifyreg32(LM3S_SYSCON_RCGC2_OFFSET, 0, SYSCON_RCGC2_GPIOE);
|
||||
leddbg("Initializing\n");
|
||||
|
||||
/* Configure Port E, Bit 1 as an output, initial value=OFF */
|
||||
|
||||
lm3s_configgpio(GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | 1);
|
||||
led_dumpgpio("up_ledinit before lm3s_configgpio()");
|
||||
lm3s_configgpio(LED_GPIO);
|
||||
led_dumpgpio("up_ledinit after lm3s_configgpio()");
|
||||
g_nest = 0;
|
||||
}
|
||||
|
||||
@@ -103,7 +127,9 @@ void up_ledon(int led)
|
||||
g_nest++;
|
||||
case LED_IRQSENABLED:
|
||||
case LED_STACKCREATED:
|
||||
modifyreg32(LM3S_GPIOE_DATA, 0, (1 << 1));
|
||||
led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
|
||||
lm3s_gpiowrite(LED_GPIO, FALSE);
|
||||
led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +155,9 @@ void up_ledoff(int led)
|
||||
case LED_PANIC:
|
||||
if (--g_nest <= 0)
|
||||
{
|
||||
modifyreg32(LM3S_GPIOE_DATA, (1 << 1), 0);
|
||||
led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
|
||||
lm3s_gpiowrite(LED_GPIO, TRUE);
|
||||
led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean sel
|
||||
{
|
||||
/* Assert the CS pin to the card */
|
||||
|
||||
lm3s_gpiowrite(SDC_CS, selected ? 0 : 1);
|
||||
lm3s_gpiowrite(SDCCS_GPIO, !selected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user