LPC4357-EVB: Fix LEDs; comment out old unimplemented button stuff

This commit is contained in:
Gregory Nutt
2014-11-27 10:28:32 -06:00
parent a0fbe36204
commit 8fa2d01ac3
7 changed files with 178 additions and 150 deletions
+3 -3
View File
@@ -58,8 +58,8 @@
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by /* Pin configuration for each LPC4330 Xplorer button. This array is indexed
* the BUTTON_* and JOYSTICK_* definitions in board.h * by the BUTTON_* definitions in board.h
*/ */
static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] = static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] =
@@ -67,7 +67,7 @@ static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] =
LPC4330_XPLORER_BUT1 LPC4330_XPLORER_BUT1
}; };
/* This array defines all of the interupt handlers current attached to /* This array defines all of the interrupt handlers current attached to
* button events. * button events.
*/ */
+45 -3
View File
@@ -23,6 +23,7 @@ Contents
- NuttX EABI "buildroot" Toolchain - NuttX EABI "buildroot" Toolchain
- NuttX OABI "buildroot" Toolchain - NuttX OABI "buildroot" Toolchain
- NXFLAT Toolchain - NXFLAT Toolchain
- LED and Pushbuttons
- Serial Console - Serial Console
- FPU - FPU
- LPC4357-EVB Configuration Options - LPC4357-EVB Configuration Options
@@ -543,6 +544,47 @@ NXFLAT Toolchain
8. Edit setenv.h, if necessary, so that the PATH variable includes 8. Edit setenv.h, if necessary, so that the PATH variable includes
the path to the newly builtNXFLAT binaries. the path to the newly builtNXFLAT binaries.
LED and Pushbuttons
===================
LED
---
The LPC4357-EVB has one user-controllable LED labelled D6 controlled
by the signal LED_3V3:
LED SIGNAL MCU
D6 LED_3V3 PE_& GPIO7[7]
LED is grounded and a high output illuminates the LED.
If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
for NuttX debug functionality (where NC means "No Change").
-------------------------- ---------
LED
-------------------------- ---------
LED_STARTED OFF
LED_HEAPALLOCATE OFF
LED_IRQSENABLED OFF
LED_STACKCREATED ON
LED_INIRQ NC
LED_SIGNAL NC
LED_ASSERTION NC
LED_PANIC Flashing
-------------------------- ---------
If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
control of the application. The following interfaces are then available
for application control of the LEDs:
void lpc43_ledinit(void);
void lpc43_setled(int led, bool ledon);
void lpc43_setleds(uint8_t ledset);
Pushbuttons
-----------
To be provided
Serial Console Serial Console
============== ==============
@@ -970,7 +1012,7 @@ STATUS
1. This configuration derives from the LPC4330 Xplorer configuration. In 1. This configuration derives from the LPC4330 Xplorer configuration. In
many cases there have been global substitutions for naming to the many cases there have been global substitutions for naming to the
LPC4357 EVB without corresponding updates to the technical description. LPC4357 EVB without corresponding updates to the technical description.
Thus all technical details should be taken with a grain of salt. Things Thus all technical details should be taken with a grain of salt. GPIO
like LEDs and buttons actually are remnants of the LPC4330-Xplorer that definitions may actually are remnants of the LPC4330-Xplorer that still
still need clean-up. need clean-up.
+29 -23
View File
@@ -198,29 +198,41 @@
#define BOARD_USART3_BASEFREQ BOARD_XTAL_FREQUENCY #define BOARD_USART3_BASEFREQ BOARD_XTAL_FREQUENCY
/* LED definitions *********************************************************/ /* LED definitions *********************************************************/
/* The LPC4357-EVB has 2 user-controllable LEDs labeled D2 an D3 in the /* The LPC4357-EVB has one user-controllable LED labelled D6 controlled
* schematic and on but referred to has LED1 and LED2 here, respectively. * by the signal LED_3V3:
* *
* LED1 D2 GPIO1[12] * ---- ------- -------------
* LED2 D3 GPIO1[11] * LED SIGNAL MCU
* ---- ------- -------------
* D6 LED_3V3 PE_7 GPIO7[7]
* ---- ------- -------------
* *
* LEDs are pulled high to a low output illuminates the LED. * LED is grounded and a high output illuminates the LED.
* *
* LED index values for use with lpc43_setled() * LED index values for use with lpc43_setled()
*/ */
#define BOARD_LED1 0 #define BOARD_LED 0
#define BOARD_LED2 1 #define BOARD_NLEDS 1
#define BOARD_NLEDS 2
/* LED bits for use with lpc43_setleds() */ /* LED bits for use with lpc43_setleds() */
#define BOARD_LED1_BIT (1 << BOARD_LED1) #define BOARD_LED _BIT (1 << BOARD_LED)
#define BOARD_LED2_BIT (1 << BOARD_LED2)
/* If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows /* If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
* for NuttX debug functionality (where NC means "No Change"). If * for NuttX debug functionality (where NC means "No Change").
* CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under */
/* LED */
#define LED_STARTED 0 /* OFF */
#define LED_HEAPALLOCATE 0 /* OFF */
#define LED_IRQSENABLED 0 /* OFF */
#define LED_STACKCREATED 1 /* ON */
#define LED_INIRQ 2 /* NC */
#define LED_SIGNAL 2 /* NC */
#define LED_ASSERTION 2 /* NC */
#define LED_PANIC 3 /* Flashing */
/* If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
* control of the application. The following interfaces are then available * control of the application. The following interfaces are then available
* for application control of the LEDs: * for application control of the LEDs:
* *
@@ -228,18 +240,12 @@
* void lpc43_setled(int led, bool ledon); * void lpc43_setled(int led, bool ledon);
* void lpc43_setleds(uint8_t ledset); * void lpc43_setleds(uint8_t ledset);
*/ */
/* ON OFF */
/* LED1 LED2 LED1 LED2 */ /* Button definitions *******************************************************/
#define LED_STARTED 0 /* OFF OFF - - */ /* To be provided */
#define LED_HEAPALLOCATE 1 /* ON OFF - - */
#define LED_IRQSENABLED 1 /* ON OFF - - */
#define LED_STACKCREATED 1 /* ON OFF - - */
#define LED_INIRQ 2 /* NC ON NC OFF */
#define LED_SIGNAL 2 /* NC ON NC OFF */
#define LED_ASSERTION 2 /* NC ON NC OFF */
#define LED_PANIC 2 /* NC ON NC OFF */
/* UART Pins ****************************************************************/ /* UART Pins ****************************************************************/
/* REVISIT: Thee are most likely left over from the LPC4330-Xplorer */
/* The LPC4357-EVB does not have RS-232 drivers or serial connectors on /* The LPC4357-EVB does not have RS-232 drivers or serial connectors on
* board. USART0 and UART1 are available on J8 as follows: * board. USART0 and UART1 are available on J8 as follows:
* *
+18 -51
View File
@@ -49,56 +49,33 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* LED definitions **********************************************************/
/**************************************************************************** /* The LPC4357-EVB has one user-controllable LED labelled D6 controlled by
* LEDs GPIO PIN SIGNAL NAME * the signal LED_3V3:
* -------------------------------- ------- -------------- *
* gpio1[12] - LED D2 J10-20 LED1 * ---- ------- -------------
* gpio1[11] - LED D3 J10-17 LED2 * LED SIGNAL MCU
****************************************************************************/ * ---- ------- -------------
* D6 LED_3V3 PE_7 GPIO7[7]
/* Definitions to configure LED pins as GPIOs: * ---- ------- -------------
*
* LED is grounded and a high output illuminates the LED.
*
* Definitions to configure LED pins as GPIOs:
* *
* - Floating * - Floating
* - Normal drive * - Normal drive
* - No buffering, glitch filtering, slew=slow * - No buffering, glitch filtering, slew=slow
*/ */
#define PINCONFIG_LED1 PINCONF_GPIO1p12 #define PINCONFIG_LED PINCONF_GPIO7p7
#define PINCONFIG_LED2 PINCONF_GPIO1p11
/* Definitions to configure LED GPIOs as outputs */ /* Definitions to configure LED GPIO as outputs */
#define GPIO_LED1 (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN12) #define GPIO_LED (GPIO_MODE_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT7 | GPIO_PIN7)
#define GPIO_LED2 (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN11)
/**************************************************************************** /* Button definitions *******************************************************/
* Buttons GPIO PIN SIGNAL NAME /* to be provided */
* -------------------------------- ------- --------------
* gpio0[7] - User Button SW2 J8-25 BTN1
****************************************************************************/
#define LPC4357EVB_BUT1 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT0 | GPIO_PIN7)
/* Button IRQ numbers */
#define LPC4357EVB_BUT1_IRQ LPC43_IRQ_P0p23
#define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_1
#define GPIO_SSP0_MISO GPIO_SSP0_MISO_1
#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_1
/* We need to redefine USB_PWRD as GPIO to get USB Host working
* Also remember to add 2 resistors of 15K to D+ and D- pins.
*/
#ifdef CONFIG_USBHOST
# ifdef GPIO_USB_PWRD
# undef GPIO_USB_PWRD
# define GPIO_USB_PWRD (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN22)
# endif
#endif
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
@@ -114,15 +91,5 @@
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: lpc43_sspinitialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the Lincoln 80 board.
*
****************************************************************************/
extern void weak_function lpc43_sspinitialize(void);
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* _CONFIGS_LPC4357_EVB_SRC_LPC3257_EVB_H */ #endif /* _CONFIGS_LPC4357_EVB_SRC_LPC3257_EVB_H */
+37 -44
View File
@@ -57,35 +57,32 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
/* LED definitions **********************************************************/ /* LED definitions **********************************************************/
/* The LPC4357-EVB has 2 user-controllable LEDs labeled D2 an D3 in the /* The LPC4357-EVB has one user-controllable LED labelled D6 controlled by
* schematic and on but referred to has LED1 and LED2 here, respectively. * the signal LED_3V3:
* *
* LED1 D2 GPIO1[12] * ---- ------- -------------
* LED2 D3 GPIO1[11] * LED SIGNAL MCU
* ---- ------- -------------
* D6 LED_3V3 PE_7 GPIO7[7]
* ---- ------- -------------
* *
* LEDs are pulled high to a low output illuminates the LED. * LED is grounded and a high output illuminates the LED.
* *
* If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows * If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
* for NuttX debug functionality (where NC means "No Change"). * for NuttX debug functionality (where NC means "No Change").
* *
* ON OFF * -------------------------- --------
* LED1 LED2 LED1 LED2 * LED
* LED_STARTED 0 OFF OFF - - * -------------------------- --------
* LED_HEAPALLOCATE 1 ON OFF - - * LED_STARTED OFF
* LED_IRQSENABLED 1 ON OFF - - * LED_HEAPALLOCATE OFF
* LED_STACKCREATED 1 ON OFF - - * LED_IRQSENABLED OFF
* LED_INIRQ 2 NC ON NC OFF * LED_STACKCREATED ON
* LED_SIGNAL 2 NC ON NC OFF * LED_INIRQ NC
* LED_ASSERTION 2 NC ON NC OFF * LED_SIGNAL NC
* LED_PANIC 2 NC ON NC OFF * LED_ASSERTION NC
* * LED_PANIC Flashing
* If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under * -------------------------- --------
* control of the application. The following interfaces are then available
* for application control of the LEDs:
*
* void lpc43_ledinit(void);
* void lpc43_setled(int led, bool ledon);
* void lpc43_setleds(uint8_t ledset);
*/ */
/* Debug definitions ********************************************************/ /* Debug definitions ********************************************************/
@@ -123,8 +120,8 @@
#ifdef LED_VERBOSE #ifdef LED_VERBOSE
static void led_dumppins(FAR const char *msg) static void led_dumppins(FAR const char *msg)
{ {
lpc43_pin_dump(PINCONFIG_LED1, msg); lpc43_pin_dump(PINCONFIG_LED, msg);
lpc43_gpio_dump(GPIO_LED2, msg); lpc43_gpio_dump(GPIO_LED, msg);
} }
#else #else
# define led_dumppins(m) # define led_dumppins(m)
@@ -140,17 +137,14 @@ static void led_dumppins(FAR const char *msg)
void board_led_initialize(void) void board_led_initialize(void)
{ {
/* Configure all LED pins as GPIO outputs */ /* Configure LED pin as a GPIO outputs */
led_dumppins("board_led_initialize() Entry)"); led_dumppins("board_led_initialize() Entry)");
/* Configure LED pins as GPIOs, then configure GPIOs as outputs */ /* Configure LED pin as a GPIO, then configure GPIO as an outputs */
lpc43_pin_config(PINCONFIG_LED1); lpc43_pin_config(PINCONFIG_LED);
lpc43_gpio_config(GPIO_LED1); lpc43_gpio_config(GPIO_LED);
lpc43_pin_config(PINCONFIG_LED2);
lpc43_gpio_config(GPIO_LED2);
led_dumppins("board_led_initialize() Exit"); led_dumppins("board_led_initialize() Exit");
} }
@@ -165,17 +159,15 @@ void board_led_on(int led)
{ {
default: default:
case 0: case 0:
lpc43_gpio_write(GPIO_LED1, true); /* LED1 OFF */ lpc43_gpio_write(GPIO_LED, false); /* LED OFF */
lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */ break;
case 2: /* LED no change */
break; break;
case 1: case 1:
lpc43_gpio_write(GPIO_LED1, false); /* LED1 ON */ case 3:
lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */ lpc43_gpio_write(GPIO_LED, true); /* LED ON */
break;
case 2:
lpc43_gpio_write(GPIO_LED2, false); /* LED2 ON */
break; break;
} }
} }
@@ -191,10 +183,11 @@ void board_led_off(int led)
default: default:
case 0: case 0:
case 1: case 1:
break;
case 2: case 2:
lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */ break; /* LED no change */
case 3:
lpc43_gpio_write(GPIO_LED, false); /* LED OFF */
break; break;
} }
} }
+17 -6
View File
@@ -52,22 +52,22 @@
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
/**************************************************************************** /****************************************************************************
* Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by /* Pin configuration for each LPC4357-EVB button. This array is indexed by
* the BUTTON_* and JOYSTICK_* definitions in board.h * the BUTTON_* definitions in board.h
*/ */
#if 0 /* Not yet used */
static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] = static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] =
{ {
LPC4357EVB_BUT1
}; };
/* This array defines all of the interupt handlers current attached to /* This array defines all of the interrupt handlers current attached to
* button events. * button events.
*/ */
@@ -80,9 +80,9 @@ static xcpt_t g_buttonisr[BOARD_NUM_BUTTONS];
static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] = static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
{ {
LPC4357EVB_BUT1_IRQ
}; };
#endif #endif
#endif /* Not yet used */
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@@ -105,6 +105,7 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
void board_button_initialize(void) void board_button_initialize(void)
{ {
#if 0 /* Not yet implemented */
int i; int i;
/* Configure the GPIO pins as interrupting inputs. */ /* Configure the GPIO pins as interrupting inputs. */
@@ -113,6 +114,7 @@ void board_button_initialize(void)
{ {
lpc43_configgpio(g_buttoncfg[i]); lpc43_configgpio(g_buttoncfg[i]);
} }
#endif
} }
/**************************************************************************** /****************************************************************************
@@ -133,6 +135,7 @@ void board_button_initialize(void)
uint8_t board_buttons(void) uint8_t board_buttons(void)
{ {
#if 0 /* Not yet implemented */
uint8_t ret = 0; uint8_t ret = 0;
int i; int i;
@@ -153,6 +156,9 @@ uint8_t board_buttons(void)
} }
return ret; return ret;
#else
return 0;
#endif /* Not yet implemented */
} }
/**************************************************************************** /****************************************************************************
@@ -179,6 +185,7 @@ uint8_t board_buttons(void)
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ) #if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
xcpt_t board_button_irq(int id, xcpt_t irqhandler) xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{ {
#if 0 /* Not yet implemented */
xcpt_t oldhandler = NULL; xcpt_t oldhandler = NULL;
irqstate_t flags; irqstate_t flags;
int irq; int irq;
@@ -217,7 +224,11 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
} }
irqrestore(flags); irqrestore(flags);
} }
return oldhandler; return oldhandler;
#else
return NULL;
#endif /* Not yet implemented */
} }
#endif #endif
+29 -20
View File
@@ -57,13 +57,24 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
/* LED definitions **********************************************************/ /* LED definitions **********************************************************/
/* The LPC4357-EVB has 2 user-controllable LEDs labeled D2 an D3 in the /* The LPC4357-EVB has one user-controllable LED labelled D6 controlled by
* schematic and on but referred to has LED1 and LED2 here, respectively. * the signal LED_3V3:
* *
* LED1 D2 GPIO1[12] * ---- ------- -------------
* LED2 D3 GPIO1[11] * LED SIGNAL MCU
* ---- ------- -------------
* D6 LED_3V3 PE_7 GPIO7[7]
* ---- ------- -------------
* *
* LEDs are pulled high to a low output illuminates the LED. * LED is grounded and a high output illuminates the LED.
*
* If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
* control of the application. The following interfaces are then available
* for application control of the LEDs:
*
* void lpc43_ledinit(void);
* void lpc43_setled(int led, bool ledon);
* void lpc43_setleds(uint8_t ledset);
*/ */
/* Debug definitions ********************************************************/ /* Debug definitions ********************************************************/
@@ -101,8 +112,8 @@
#ifdef LED_VERBOSE #ifdef LED_VERBOSE
static void led_dumppins(FAR const char *msg) static void led_dumppins(FAR const char *msg)
{ {
lpc43_pin_dump(PINCONFIG_LED1, msg); lpc43_pin_dump(PINCONFIG_LED, msg);
lpc43_gpio_dump(GPIO_LED2, msg); lpc43_gpio_dump(GPIO_LED, msg);
} }
#else #else
# define led_dumppins(m) # define led_dumppins(m)
@@ -118,19 +129,16 @@ static void led_dumppins(FAR const char *msg)
void lpc43_ledinit(void) void lpc43_ledinit(void)
{ {
/* Configure all LED GPIO lines */ /* Configure LED pin as a GPIO outputs */
led_dumppins("lpc43_ledinit() Entry)"); led_dumppins("board_led_initialize() Entry)");
/* Configure LED pins as GPIOs, then configure GPIOs as outputs */ /* Configure LED pin as a GPIO, then configure GPIO as an outputs */
lpc43_pin_config(PINCONFIG_LED1); lpc43_pin_config(PINCONFIG_LED);
lpc43_gpio_config(GPIO_LED1); lpc43_gpio_config(GPIO_LED);
lpc43_pin_config(PINCONFIG_LED2); led_dumppins("board_led_initialize() Exit");
lpc43_gpio_config(GPIO_LED2);
led_dumppins("lpc43_ledinit() Exit");
} }
/**************************************************************************** /****************************************************************************
@@ -139,8 +147,10 @@ void lpc43_ledinit(void)
void lpc43_setled(int led, bool ledon) void lpc43_setled(int led, bool ledon)
{ {
uint16_t gpiocfg = (led == BOARD_LED1 ? GPIO_LED1 : GPIO_LED2); if (led == BOARD_LED)
lpc43_gpio_write(gpiocfg, !ledon); {
lpc43_gpio_write(GPIO_LED, ledon);
}
} }
/**************************************************************************** /****************************************************************************
@@ -149,8 +159,7 @@ void lpc43_setled(int led, bool ledon)
void lpc43_setleds(uint8_t ledset) void lpc43_setleds(uint8_t ledset)
{ {
lpc43_gpio_write(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0); lpc43_gpio_write(GPIO_LED, (ledset & BOARD_LED_BIT) != 0);
lpc43_gpio_write(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0);
} }
#endif /* !CONFIG_ARCH_LEDS */ #endif /* !CONFIG_ARCH_LEDS */