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

View File

@ -58,8 +58,8 @@
/****************************************************************************
* Private Data
****************************************************************************/
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
* the BUTTON_* and JOYSTICK_* definitions in board.h
/* Pin configuration for each LPC4330 Xplorer button. This array is indexed
* by the BUTTON_* definitions in board.h
*/
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
};
/* This array defines all of the interupt handlers current attached to
/* This array defines all of the interrupt handlers current attached to
* button events.
*/

View File

@ -23,6 +23,7 @@ Contents
- NuttX EABI "buildroot" Toolchain
- NuttX OABI "buildroot" Toolchain
- NXFLAT Toolchain
- LED and Pushbuttons
- Serial Console
- FPU
- LPC4357-EVB Configuration Options
@ -543,6 +544,47 @@ NXFLAT Toolchain
8. Edit setenv.h, if necessary, so that the PATH variable includes
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
==============
@ -970,7 +1012,7 @@ STATUS
1. This configuration derives from the LPC4330 Xplorer configuration. In
many cases there have been global substitutions for naming to the
LPC4357 EVB without corresponding updates to the technical description.
Thus all technical details should be taken with a grain of salt. Things
like LEDs and buttons actually are remnants of the LPC4330-Xplorer that
still need clean-up.
Thus all technical details should be taken with a grain of salt. GPIO
definitions may actually are remnants of the LPC4330-Xplorer that still
need clean-up.

View File

@ -198,29 +198,41 @@
#define BOARD_USART3_BASEFREQ BOARD_XTAL_FREQUENCY
/* LED definitions *********************************************************/
/* The LPC4357-EVB has 2 user-controllable LEDs labeled D2 an D3 in the
* schematic and on but referred to has LED1 and LED2 here, respectively.
/* The LPC4357-EVB has one user-controllable LED labelled D6 controlled
* 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()
*/
#define BOARD_LED1 0
#define BOARD_LED2 1
#define BOARD_NLEDS 2
#define BOARD_LED 0
#define BOARD_NLEDS 1
/* LED bits for use with lpc43_setleds() */
#define BOARD_LED1_BIT (1 << BOARD_LED1)
#define BOARD_LED2_BIT (1 << BOARD_LED2)
#define BOARD_LED _BIT (1 << BOARD_LED)
/* If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows
* for NuttX debug functionality (where NC means "No Change"). If
* CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
/* If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
* for NuttX debug functionality (where NC means "No Change").
*/
/* 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
* for application control of the LEDs:
*
@ -228,18 +240,12 @@
* void lpc43_setled(int led, bool ledon);
* void lpc43_setleds(uint8_t ledset);
*/
/* ON OFF */
/* LED1 LED2 LED1 LED2 */
#define LED_STARTED 0 /* OFF OFF - - */
#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 */
/* Button definitions *******************************************************/
/* To be provided */
/* 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
* board. USART0 and UART1 are available on J8 as follows:
*

View File

@ -49,56 +49,33 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* LEDs GPIO PIN SIGNAL NAME
* -------------------------------- ------- --------------
* gpio1[12] - LED D2 J10-20 LED1
* gpio1[11] - LED D3 J10-17 LED2
****************************************************************************/
/* Definitions to configure LED pins as GPIOs:
/* LED definitions **********************************************************/
/* The LPC4357-EVB has one user-controllable LED labelled D6 controlled by
* the signal LED_3V3:
*
* ---- ------- -------------
* LED SIGNAL MCU
* ---- ------- -------------
* D6 LED_3V3 PE_7 GPIO7[7]
* ---- ------- -------------
*
* LED is grounded and a high output illuminates the LED.
*
* Definitions to configure LED pins as GPIOs:
*
* - Floating
* - Normal drive
* - No buffering, glitch filtering, slew=slow
*/
#define PINCONFIG_LED1 PINCONF_GPIO1p12
#define PINCONFIG_LED2 PINCONF_GPIO1p11
#define PINCONFIG_LED PINCONF_GPIO7p7
/* 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_LED2 (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN11)
#define GPIO_LED (GPIO_MODE_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT7 | GPIO_PIN7)
/****************************************************************************
* Buttons GPIO PIN SIGNAL NAME
* -------------------------------- ------- --------------
* 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
/* Button definitions *******************************************************/
/* to be provided */
/****************************************************************************
* Public Types
@ -114,15 +91,5 @@
* 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 /* _CONFIGS_LPC4357_EVB_SRC_LPC3257_EVB_H */

View File

@ -57,35 +57,32 @@
* Definitions
****************************************************************************/
/* LED definitions **********************************************************/
/* The LPC4357-EVB has 2 user-controllable LEDs labeled D2 an D3 in the
* schematic and on but referred to has LED1 and LED2 here, respectively.
/* The LPC4357-EVB has one user-controllable LED labelled D6 controlled 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.
*
* 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").
*
* ON OFF
* LED1 LED2 LED1 LED2
* LED_STARTED 0 OFF OFF - -
* LED_HEAPALLOCATE 1 ON OFF - -
* LED_IRQSENABLED 1 ON OFF - -
* LED_STACKCREATED 1 ON OFF - -
* LED_INIRQ 2 NC ON NC OFF
* LED_SIGNAL 2 NC ON NC OFF
* LED_ASSERTION 2 NC ON NC OFF
* LED_PANIC 2 NC ON NC OFF
*
* 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);
* -------------------------- --------
* 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
* -------------------------- --------
*/
/* Debug definitions ********************************************************/
@ -123,8 +120,8 @@
#ifdef LED_VERBOSE
static void led_dumppins(FAR const char *msg)
{
lpc43_pin_dump(PINCONFIG_LED1, msg);
lpc43_gpio_dump(GPIO_LED2, msg);
lpc43_pin_dump(PINCONFIG_LED, msg);
lpc43_gpio_dump(GPIO_LED, msg);
}
#else
# define led_dumppins(m)
@ -140,17 +137,14 @@ static void led_dumppins(FAR const char *msg)
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)");
/* 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_gpio_config(GPIO_LED1);
lpc43_pin_config(PINCONFIG_LED2);
lpc43_gpio_config(GPIO_LED2);
lpc43_pin_config(PINCONFIG_LED);
lpc43_gpio_config(GPIO_LED);
led_dumppins("board_led_initialize() Exit");
}
@ -165,17 +159,15 @@ void board_led_on(int led)
{
default:
case 0:
lpc43_gpio_write(GPIO_LED1, true); /* LED1 OFF */
lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */
lpc43_gpio_write(GPIO_LED, false); /* LED OFF */
break;
case 2: /* LED no change */
break;
case 1:
lpc43_gpio_write(GPIO_LED1, false); /* LED1 ON */
lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */
break;
case 2:
lpc43_gpio_write(GPIO_LED2, false); /* LED2 ON */
case 3:
lpc43_gpio_write(GPIO_LED, true); /* LED ON */
break;
}
}
@ -191,10 +183,11 @@ void board_led_off(int led)
default:
case 0:
case 1:
break;
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;
}
}

View File

@ -52,22 +52,22 @@
#ifdef CONFIG_ARCH_BUTTONS
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
* the BUTTON_* and JOYSTICK_* definitions in board.h
/* Pin configuration for each LPC4357-EVB button. This array is indexed by
* the BUTTON_* definitions in board.h
*/
#if 0 /* Not yet used */
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.
*/
@ -80,9 +80,9 @@ static xcpt_t g_buttonisr[BOARD_NUM_BUTTONS];
static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
{
LPC4357EVB_BUT1_IRQ
};
#endif
#endif /* Not yet used */
/****************************************************************************
* Private Functions
@ -105,6 +105,7 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
void board_button_initialize(void)
{
#if 0 /* Not yet implemented */
int i;
/* Configure the GPIO pins as interrupting inputs. */
@ -113,6 +114,7 @@ void board_button_initialize(void)
{
lpc43_configgpio(g_buttoncfg[i]);
}
#endif
}
/****************************************************************************
@ -133,6 +135,7 @@ void board_button_initialize(void)
uint8_t board_buttons(void)
{
#if 0 /* Not yet implemented */
uint8_t ret = 0;
int i;
@ -153,6 +156,9 @@ uint8_t board_buttons(void)
}
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)
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
#if 0 /* Not yet implemented */
xcpt_t oldhandler = NULL;
irqstate_t flags;
int irq;
@ -217,7 +224,11 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
}
irqrestore(flags);
}
return oldhandler;
#else
return NULL;
#endif /* Not yet implemented */
}
#endif

View File

@ -57,13 +57,24 @@
* Definitions
****************************************************************************/
/* LED definitions **********************************************************/
/* The LPC4357-EVB has 2 user-controllable LEDs labeled D2 an D3 in the
* schematic and on but referred to has LED1 and LED2 here, respectively.
/* The LPC4357-EVB has one user-controllable LED labelled D6 controlled 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.
*
* 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 ********************************************************/
@ -101,8 +112,8 @@
#ifdef LED_VERBOSE
static void led_dumppins(FAR const char *msg)
{
lpc43_pin_dump(PINCONFIG_LED1, msg);
lpc43_gpio_dump(GPIO_LED2, msg);
lpc43_pin_dump(PINCONFIG_LED, msg);
lpc43_gpio_dump(GPIO_LED, msg);
}
#else
# define led_dumppins(m)
@ -118,19 +129,16 @@ static void led_dumppins(FAR const char *msg)
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_gpio_config(GPIO_LED1);
lpc43_pin_config(PINCONFIG_LED);
lpc43_gpio_config(GPIO_LED);
lpc43_pin_config(PINCONFIG_LED2);
lpc43_gpio_config(GPIO_LED2);
led_dumppins("lpc43_ledinit() Exit");
led_dumppins("board_led_initialize() Exit");
}
/****************************************************************************
@ -139,8 +147,10 @@ void lpc43_ledinit(void)
void lpc43_setled(int led, bool ledon)
{
uint16_t gpiocfg = (led == BOARD_LED1 ? GPIO_LED1 : GPIO_LED2);
lpc43_gpio_write(gpiocfg, !ledon);
if (led == BOARD_LED)
{
lpc43_gpio_write(GPIO_LED, ledon);
}
}
/****************************************************************************
@ -149,8 +159,7 @@ void lpc43_setled(int led, bool ledon)
void lpc43_setleds(uint8_t ledset)
{
lpc43_gpio_write(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0);
lpc43_gpio_write(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0);
lpc43_gpio_write(GPIO_LED, (ledset & BOARD_LED_BIT) != 0);
}
#endif /* !CONFIG_ARCH_LEDS */