Revision 0:e0042c0c4d2d, committed 2014-10-28
- Comitter:
- Clemo
- Date:
- Tue Oct 28 12:20:47 2014 +0000
- Commit message:
- Error & warning free.
Changed in this revision
diff -r 000000000000 -r e0042c0c4d2d board.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/board.c Tue Oct 28 12:20:47 2014 +0000
@@ -0,0 +1,279 @@
+/*
+ * @brief LPCXpresso 1347 board file
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+//#include "retarget.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#if defined (BOARD_ELEKTOR_140182)
+ #define BUTTONS_BUTTON1_GPIO_PORT_NUM BOARD_KEYBOARD_ISP_PORT
+ #define BUTTONS_BUTTON1_GPIO_BIT_NUM BOARD_KEYBOARD_ISP_PIN
+#else
+ #define BUTTONS_BUTTON1_GPIO_PORT_NUM 0
+ #define BUTTONS_BUTTON1_GPIO_BIT_NUM 16
+#endif
+
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* System oscillator rate and clock rate on the CLKIN pin */
+const uint32_t OscRateIn = 12000000;
+const uint32_t ExtRateIn = 0;
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize pin muxing for UART interface */
+void Board_UART_Init(void)
+{
+ /* Pin Muxing has already been done during SystemInit */
+}
+
+/* Sends a character on the UART */
+void Board_UARTPutChar(char ch)
+{
+#if defined(DEBUG_ENABLE)
+ /* Wait for space in FIFO */
+ while ((Chip_UART_ReadLineStatus(DEBUG_UART) & UART_LSR_THRE) == 0) {}
+ Chip_UART_SendByte(DEBUG_UART, (uint8_t) ch);
+#endif
+}
+
+/* Gets a character from the UART, returns EOF if no character is ready */
+int Board_UARTGetChar(void)
+{
+#if defined(DEBUG_ENABLE)
+ if (Chip_UART_ReadLineStatus(DEBUG_UART) & UART_LSR_RDR) {
+ return (int) Chip_UART_ReadByte(DEBUG_UART);
+ }
+#endif
+ return EOF;
+}
+
+/* Outputs a string on the debug UART */
+void Board_UARTPutSTR(char *str)
+{
+#if defined(DEBUG_ENABLE)
+ while (*str != '\0') {
+ Board_UARTPutChar(*str++);
+ }
+#endif
+}
+
+/* Initialize debug output via UART for board */
+void Board_Debug_Init(void)
+{
+#if defined(DEBUG_ENABLE)
+ Board_UART_Init();
+
+ /* Setup UART for 115.2K8N1 */
+ Chip_UART_Init(LPC_USART);
+ Chip_UART_SetBaud(LPC_USART, 115200);
+ Chip_UART_ConfigData(LPC_USART, (UART_LCR_WLEN8 | UART_LCR_SBS_1BIT));
+ Chip_UART_SetupFIFOS(LPC_USART, (UART_FCR_FIFO_EN | UART_FCR_TRG_LEV2));
+ Chip_UART_TXEnable(LPC_USART);
+#endif
+}
+
+/* Initializes board LED(s) */
+void Board_LED_Init(void)
+{
+ // Set PIO0_8, _9, _10 & _18 as output.
+ //Chip_GPIO_WriteDirBit(LPC_GPIO_PORT,BOARD_LED2_RED_PORT,BOARD_LED2_RED_PIN,OUTPUT);
+ //Chip_GPIO_WriteDirBit(LPC_GPIO_PORT,BOARD_LED1_RED_PORT,BOARD_LED1_RED_PIN,OUTPUT);
+ //Chip_GPIO_WriteDirBit(LPC_GPIO_PORT,BOARD_LED2_GREEN_PORT,BOARD_LED2_GREEN_PIN,OUTPUT);
+ //Chip_GPIO_WriteDirBit(LPC_GPIO_PORT,BOARD_LED1_GREEN_PORT,BOARD_LED1_GREEN_PIN,OUTPUT);
+ // Set PIO1_31 as output.
+ //Chip_GPIO_WriteDirBit(LPC_GPIO_PORT,BOARD_LED3_PORT,BOARD_LED3_PIN,OUTPUT);
+}
+
+/* Sets the state of a board LED to on or off */
+void Board_LED_Set(uint8_t LEDNumber, bool On)
+{
+ if (LEDNumber==BOARD_LED1_GREEN)
+ {
+ //Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LED1_GREEN_PORT,BOARD_LED1_GREEN_PIN,On);
+ }
+ else if (LEDNumber==BOARD_LED1_RED)
+ {
+ //Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LED1_RED_PORT,BOARD_LED1_RED_PIN,On);
+ }
+ else if (LEDNumber==BOARD_LED2_GREEN)
+ {
+ //Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LED2_GREEN_PORT,BOARD_LED2_GREEN_PIN,On);
+ }
+ else if (LEDNumber==BOARD_LED2_RED)
+ {
+ //Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LED2_RED_PORT,BOARD_LED2_RED_PIN,On);
+ }
+ else if (LEDNumber==BOARD_LED3)
+ {
+ //Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LED3_PORT,BOARD_LED3_PIN,On);
+ }
+}
+
+/* Returns the current state of a board LED */
+bool Board_LED_Test(uint8_t LEDNumber)
+{
+ bool state = false;
+
+ if (LEDNumber==BOARD_LED1_GREEN)
+ {
+ //state = Chip_GPIO_ReadPortBit(LPC_GPIO_PORT,BOARD_LED1_GREEN_PORT,BOARD_LED1_GREEN_PIN);
+ }
+ else if (LEDNumber==BOARD_LED1_RED)
+ {
+ //state = Chip_GPIO_ReadPortBit(LPC_GPIO_PORT,BOARD_LED1_RED_PORT,BOARD_LED1_RED_PIN);
+ }
+ else if (LEDNumber==BOARD_LED2_GREEN)
+ {
+ //state = Chip_GPIO_ReadPortBit(LPC_GPIO_PORT,BOARD_LED2_GREEN_PORT,BOARD_LED2_GREEN_PIN);
+ }
+ else if (LEDNumber==BOARD_LED2_RED)
+ {
+ //state = Chip_GPIO_ReadPortBit(LPC_GPIO_PORT,BOARD_LED2_RED_PORT,BOARD_LED2_RED_PIN);
+ }
+ else if (LEDNumber==BOARD_LED3)
+ {
+ //state = Chip_GPIO_ReadPortBit(LPC_GPIO_PORT,BOARD_LED3_PORT,BOARD_LED3_PIN);
+ }
+
+ return state;
+}
+
+void Board_LED_Toggle(uint8_t LEDNumber)
+{
+ Board_LED_Set(LEDNumber,Board_LED_Test(LEDNumber)==false?true:false);
+}
+
+
+void Board_LCD_Init(void)
+{
+ // Setup backlight control.
+ //Chip_IOCON_PinMuxSet(LPC_IOCON,BOARD_LCD_BACKLIGHT_PORT,BOARD_LCD_BACKLIGHT_PIN,IOCON_DIGMODE_EN);
+ //Chip_GPIO_WriteDirBit(LPC_GPIO_PORT,BOARD_LCD_BACKLIGHT_PORT,BOARD_LCD_BACKLIGHT_PIN,OUTPUT);
+
+ // Setup reset control.
+ //Chip_IOCON_PinMuxSet(LPC_IOCON,BOARD_LCD_RESET_PORT,BOARD_LCD_RESET_PIN,IOCON_DIGMODE_EN);
+ //Chip_GPIO_WriteDirBit(LPC_GPIO_PORT,BOARD_LCD_RESET_PORT,BOARD_LCD_RESET_PIN,OUTPUT);
+}
+
+
+void Board_LCD_ResetAssert(void)
+{
+ //Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LCD_RESET_PORT,BOARD_LCD_RESET_PIN,false);
+}
+
+
+void Board_LCD_ResetDeassert(void)
+{
+ //Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LCD_RESET_PORT,BOARD_LCD_RESET_PIN,true);
+}
+
+
+void Board_LCD_SetBacklight(uint8_t Intensity)
+{
+ //if (Intensity!=0) Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LCD_BACKLIGHT_PORT,BOARD_LCD_BACKLIGHT_PIN,BOARD_LCD_BACKLIGHT_ON);
+ //else Chip_GPIO_WritePortBit(LPC_GPIO_PORT,BOARD_LCD_BACKLIGHT_PORT,BOARD_LCD_BACKLIGHT_PIN,BOARD_LCD_BACKLIGHT_OFF);
+}
+
+
+/* Set up and initialize all required blocks and functions related to the
+ board hardware */
+void Board_Init(void)
+{
+ /* Sets up DEBUG UART */
+ DEBUGINIT();
+
+ /* Initialize GPIO */
+ //Chip_GPIO_Init(LPC_GPIO_PORT);
+
+ /* Initialize LEDs */
+ Board_LED_Init();
+ Board_LED_Set(BOARD_LED1_GREEN,BOARD_LED_OFF);
+ Board_LED_Set(BOARD_LED1_RED,BOARD_LED_OFF);
+ Board_LED_Set(BOARD_LED2_GREEN,BOARD_LED_OFF);
+ Board_LED_Set(BOARD_LED2_RED,BOARD_LED_OFF);
+ Board_LED_Set(BOARD_LED3,BOARD_LED_ON); // LED3 is inverted compared to LED1 & LED2.
+
+ // Initialize LCD.
+ Board_LCD_Init();
+ // Put it in reset.
+ Board_LCD_ResetAssert();
+ // Backlight off.
+ Board_LCD_SetBacklight(false);
+}
+
+/* Initialize pin muxing for SSP interface */
+void Board_SSP_Init(LPC_SSP_T *pSSP)
+{
+ if (pSSP == LPC_SSP0) {
+ }
+ else {
+ //Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 23, (IOCON_FUNC2 | IOCON_MODE_PULLUP)); /* PIO1_23 connected to SSEL1 */
+ //Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 20, (IOCON_FUNC2 | IOCON_MODE_PULLUP)); /* PIO1_20 connected to SCK1 */
+ //Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 21, (IOCON_FUNC2 | IOCON_MODE_PULLUP)); /* PIO1_21 connected to MISO1 */
+ //Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 22, (IOCON_FUNC2 | IOCON_MODE_PULLUP)); /* PIO1_22 connected to MOSI1 */
+ }
+}
+
+/* Configure pin for ADC channel 0 */
+void Board_ADC_Init(void)
+{
+ /* Muxing already setup as part of SystemInit for AD0 */
+}
+
+/* Initialize buttons on the board */
+void Board_Buttons_Init(void)
+{
+ //Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, BUTTONS_BUTTON1_GPIO_PORT_NUM, BUTTONS_BUTTON1_GPIO_BIT_NUM, false);
+}
+
+/* Get button status */
+uint32_t Buttons_GetStatus(void)
+{
+ uint8_t ret = NO_BUTTON_PRESSED;
+ //if (Chip_GPIO_ReadPortBit(LPC_GPIO_PORT, BUTTONS_BUTTON1_GPIO_PORT_NUM, BUTTONS_BUTTON1_GPIO_BIT_NUM) == 0x00) {
+ // ret |= BUTTONS_BUTTON1;
+ //}
+ return ret;
+}
+
diff -r 000000000000 -r e0042c0c4d2d board.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/board.h Tue Oct 28 12:20:47 2014 +0000
@@ -0,0 +1,291 @@
+/*
+ * @brief NXP LPCXpresso 1347 board file
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __BOARD_H_
+#define __BOARD_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#define STATIC static
+#define IOCON_FUNC0 (0)
+#define IOCON_FUNC1 (1)
+#define IOCON_FUNC2 (2)
+#define IOCON_FUNC3 (3)
+#define IOCON_RESERVED_BIT_7 (0)
+#define IOCON_SFI2C_EN (1)
+#define IOCON_DIGMODE_EN (2)
+#define IOCON_INV_EN (3)
+#define IOCON_MODE_PULLUP (4)
+
+//#include "chip.h"
+/* board_api.h is included at the bottom of this file after DEBUG setup */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup BOARD_NXP_LPCXPRESSO_1347 NXP LPC1347 Xpresso board support functions
+ * @ingroup LPCOPEN_13XX_BOARD_LPCXPRESSO_1347
+ * @{
+ */
+
+/** @defgroup BOARD_NXP_LPCXPRESSO_1347_OPTIONS BOARD: NXP LPC1347 Xpresso board build options
+ * This board has options that configure its operation at build-time.<br>
+ * @{
+ */
+
+ /** Define DEBUG_ENABLE to enable IO via the DEBUGSTR, DEBUGOUT, and
+ DEBUGIN macros. If not defined, DEBUG* functions will be optimized
+ out of the code at build time.
+ */
+//#define DEBUG_ENABLE
+
+/** Define DEBUG_SEMIHOSTING along with DEBUG_ENABLE to enable IO support
+ via semihosting. You may need to use a C library that supports
+ semihosting with this option.
+ */
+//#define DEBUG_SEMIHOSTING
+
+/** Board UART used for debug output and input using the DEBUG* macros. This
+ is also the port used for Board_UARTPutChar, Board_UARTGetChar, and
+ Board_UARTPutSTR functions.
+ */
+#define DEBUG_UART LPC_USART
+
+/**
+ * @}
+ */
+
+/* Board name */
+#define BOARD_ELEKTOR_140182
+
+#define OUTPUT true
+#define INPUT false
+
+// LED(s).
+#define BOARD_LED1_GREEN_PORT (0)
+#define BOARD_LED1_GREEN_PIN (18)
+#define BOARD_LED1_RED_PORT (0)
+#define BOARD_LED1_RED_PIN (9)
+#define BOARD_LED2_GREEN_PORT (0)
+#define BOARD_LED2_GREEN_PIN (10)
+#define BOARD_LED2_RED_PORT (0)
+#define BOARD_LED2_RED_PIN (8)
+#define BOARD_LED3_PORT (1)
+#define BOARD_LED3_PIN (31)
+#define BOARD_LED1_GREEN (0)
+#define BOARD_LED1_RED (1)
+#define BOARD_LED2_GREEN (2)
+#define BOARD_LED2_RED (3)
+#define BOARD_LED3 (4)
+#define BOARD_LED_OFF (true)
+#define BOARD_LED_ON (false)
+// The other LED function prototypes are in board_api.h
+void Board_LED_Init(void);
+
+
+// LCD (2x16) with I2C interface, based on ST7032i chip.
+#define BOARD_LCD_LINES (2)
+#define BOARD_LCD_CHARS_PER_LINE (16)
+#define BOARD_LCD_RESET_PORT (1)
+#define BOARD_LCD_RESET_PIN (15)
+#define BOARD_LCD_RESET_ON (0)
+#define BOARD_LCD_RESET_OFF (1)
+#define BOARD_LCD_BACKLIGHT_PORT (1)
+#define BOARD_LCD_BACKLIGHT_PIN (16)
+#define BOARD_LCD_BACKLIGHT_ON (0)
+#define BOARD_LCD_BACKLIGHT_OFF (1)
+void Board_LCD_Init(void);
+void Board_LCD_ResetAssert(void);
+void Board_LCD_ResetDeassert(void);
+void Board_LCD_SetBacklight(uint8_t Intensity);
+
+
+// Keyboard.
+#define BOARD_KEYBOARD_R0_PORT (1)
+#define BOARD_KEYBOARD_R0_PIN (23)
+#define BOARD_KEYBOARD_R1_PORT (1)
+#define BOARD_KEYBOARD_R1_PIN (24)
+#define BOARD_KEYBOARD_R2_PORT (1)
+#define BOARD_KEYBOARD_R2_PIN (25)
+#define BOARD_KEYBOARD_C0_PORT (1)
+#define BOARD_KEYBOARD_C0_PIN (26)
+#define BOARD_KEYBOARD_C1_PORT (1)
+#define BOARD_KEYBOARD_C1_PIN (28)
+#define BOARD_KEYBOARD_C2_PORT (1)
+#define BOARD_KEYBOARD_C2_PIN (29)
+
+#define BOARD_KEYBOARD_ISP_PORT (0)
+#define BOARD_KEYBOARD_ISP_PIN (1)
+
+#define BOARD_KEYBOARD_RESET_PORT (0)
+#define BOARD_KEYBOARD_RESET_PIN (0)
+// Uncomment if you don't need a reset pin in your system.
+//#define RESET_IS_GPIO
+
+// ---------------------------------------------------
+// Keys.
+// ---------------------------------------------------
+#define BOARD_KEYBOARD_S00 (0) /* S1 push */
+#define BOARD_KEYBOARD_S01 (1) /* S2 push */
+#define BOARD_KEYBOARD_S02 (2) /* S3 push */
+#define BOARD_KEYBOARD_S10 (3) /* S4 push */
+#define BOARD_KEYBOARD_S11 (4) /* S5 push */
+#define BOARD_KEYBOARD_S12 (5) /* S6 push */
+#define BOARD_KEYBOARD_S20 (6) /* S7 push */
+#define BOARD_KEYBOARD_S21 (7) /* S8 push */
+#define BOARD_KEYBOARD_S22 (8) /* S11 (spare) */
+#define BOARD_KEYBOARD_ISP (9) /* S9 */
+#if defined RESET_IS_GPIO
+#define BOARD_KEYBOARD_RESET (10) /* S10 */
+#endif
+// Other non-matrix keys go here.
+
+// --------------------------------------------------------------
+// Rotary encoders.
+// --------------------------------------------------------------
+#define BOARD_KEYBOARD_RE0 /* S1 */
+#define BOARD_KEYBOARD_RE1 /* S2 */
+#define BOARD_KEYBOARD_RE2 /* S3 */
+#define BOARD_KEYBOARD_RE3 /* S4 */
+#define BOARD_KEYBOARD_RE4 /* S5 */
+#define BOARD_KEYBOARD_RE5 /* S6 */
+#define BOARD_KEYBOARD_RE6 /* S7 */
+#define BOARD_KEYBOARD_RE7 /* S8 */
+
+#if defined(BOARD_KEYBOARD_RE0) /* S1 */
+#define BOARD_KEYBOARD_RE0_A_PORT (1)
+#define BOARD_KEYBOARD_RE0_A_PIN (19)
+#define BOARD_KEYBOARD_RE0_B_PORT (1)
+#define BOARD_KEYBOARD_RE0_B_PIN (20)
+#endif
+
+#if defined(BOARD_KEYBOARD_RE1) /* S2 */
+#define BOARD_KEYBOARD_RE1_A_PORT (1)
+#define BOARD_KEYBOARD_RE1_A_PIN (21)
+#define BOARD_KEYBOARD_RE1_B_PORT (1)
+#define BOARD_KEYBOARD_RE1_B_PIN (22)
+#endif
+
+#if defined(BOARD_KEYBOARD_RE2) /* S3 */
+#define BOARD_KEYBOARD_RE2_A_PORT (0)
+#define BOARD_KEYBOARD_RE2_A_PIN (2)
+#define BOARD_KEYBOARD_RE2_B_PORT (0)
+#define BOARD_KEYBOARD_RE2_B_PIN (11)
+#endif
+
+#if defined(BOARD_KEYBOARD_RE3) /* S4 */
+#define BOARD_KEYBOARD_RE3_A_PORT (0)
+#define BOARD_KEYBOARD_RE3_A_PIN (7)
+#define BOARD_KEYBOARD_RE3_B_PORT (0)
+#define BOARD_KEYBOARD_RE3_B_PIN (12)
+#endif
+
+#if defined(BOARD_KEYBOARD_RE4) /* S5 */
+#define BOARD_KEYBOARD_RE4_A_PORT (0)
+#define BOARD_KEYBOARD_RE4_A_PIN (17)
+#define BOARD_KEYBOARD_RE4_B_PORT (0)
+#define BOARD_KEYBOARD_RE4_B_PIN (14)
+#endif
+
+#if defined(BOARD_KEYBOARD_RE5) /* S6 */
+#define BOARD_KEYBOARD_RE5_A_PORT (0)
+#define BOARD_KEYBOARD_RE5_A_PIN (19)
+#define BOARD_KEYBOARD_RE5_B_PORT (0)
+#define BOARD_KEYBOARD_RE5_B_PIN (16)
+#endif
+
+#if defined(BOARD_KEYBOARD_RE6) /* S7 */
+#define BOARD_KEYBOARD_RE6_A_PORT (0)
+#define BOARD_KEYBOARD_RE6_A_PIN (20)
+#define BOARD_KEYBOARD_RE6_B_PORT (0)
+#define BOARD_KEYBOARD_RE6_B_PIN (22)
+#endif
+
+#if defined(BOARD_KEYBOARD_RE7) /* S8 */
+#define BOARD_KEYBOARD_RE7_A_PORT (0)
+#define BOARD_KEYBOARD_RE7_A_PIN (21)
+#define BOARD_KEYBOARD_RE7_B_PORT (0)
+#define BOARD_KEYBOARD_RE7_B_PIN (23)
+#endif
+
+#define BOARD_KEYBOARD_REPEAT_DELAY (500) /* [ms] */
+#define BOARD_KEYBOARD_REPEAT_RATE (100) /* [ms] */
+#define BOARD_KEYBOARD_DOUBLE_CLICK_MIN (100) /* [ms] */
+#define BOARD_KEYBOARD_DOUBLE_CLICK_MAX (BOARD_KEYBOARD_DOUBLE_CLICK_MIN+300) /* [ms] */
+
+
+/**
+ * Button defines
+ */
+#define BUTTONS_BUTTON1 0x01
+#define NO_BUTTON_PRESSED 0x00
+
+
+/**
+ * @brief Initialize buttons on the board
+ * @return Nothing
+ */
+void Board_Buttons_Init(void);
+
+/**
+ * @brief Get button status
+ * @return status of button
+ */
+uint32_t Buttons_GetStatus(void);
+
+/**
+ * @brief Sets up board specific ADC interface
+ * @return Nothing
+ */
+void Board_ADC_Init(void);
+
+typedef uint32_t LPC_SSP_T;
+#define LPC_SSP0 ((uint32_t*)0)
+/**
+ * @brief Initialize pin muxing for SSP interface
+ * @param pSSP : Pointer to SSP interface to initialize
+ * @return Nothing
+ */
+void Board_SSP_Init(LPC_SSP_T *pSSP);
+
+/**
+ * @}
+ */
+
+#include "board_api.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOARD_H_ */
diff -r 000000000000 -r e0042c0c4d2d board_api.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/board_api.h Tue Oct 28 12:20:47 2014 +0000
@@ -0,0 +1,176 @@
+/*
+ * @brief Common board API functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __BOARD_API_H_
+#define __BOARD_API_H_
+
+//#include "lpc_types.h"
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup BOARD_COMMON_API BOARD: Common board functions
+ * @ingroup BOARD_Common
+ * This file contains common board definitions that are shared across
+ * boards and devices. All of these functions do not need to be
+ * implemented for a specific board, but if they are implemented, they
+ * should use this API standard.
+ * @{
+ */
+
+/**
+ * @brief Setup and initialize hardware prior to call to main()
+ * @return None
+ * @note Board_SystemInit() is called prior to the application and sets up system
+ * clocking, memory, and any resources needed prior to the application
+ * starting.
+ */
+void Board_SystemInit(void);
+
+/**
+ * @brief Setup pin multiplexer per board schematics
+ * @return None
+ * @note Board_SetupMuxing() should be called from SystemInit() prior to application
+ * main() is called. So that the PINs are set in proper state.
+ */
+void Board_SetupMuxing(void);
+
+/**
+ * @brief Setup system clocking
+ * @return None
+ * @note This sets up board clocking.
+ */
+void Board_SetupClocking(void);
+
+/**
+ * @brief Setup external system memory
+ * @return None
+ * @note This function is typically called after pin mux setup and clock setup and
+ * sets up any external memory needed by the system (DRAM, SRAM, etc.). Not all
+ * boards need this function.
+ */
+void Board_SetupExtMemory(void);
+
+/**
+ * @brief Set up and initialize all required blocks and functions related to the board hardware.
+ * @return None
+ */
+void Board_Init(void);
+
+/**
+ * @brief Initializes board UART for output, required for printf redirection
+ * @return None
+ */
+void Board_Debug_Init(void);
+
+/**
+ * @brief Sends a single character on the UART, required for printf redirection
+ * @param ch : character to send
+ * @return None
+ */
+void Board_UARTPutChar(char ch);
+
+/**
+ * @brief Get a single character from the UART, required for scanf input
+ * @return EOF if not character was received, or character value
+ */
+int Board_UARTGetChar(void);
+
+/**
+ * @brief Prints a string to the UART
+ * @param str : Terminated string to output
+ * @return None
+ */
+void Board_UARTPutSTR(char *str);
+
+/**
+ * @brief Sets the state of a board LED to on or off
+ * @param LEDNumber : LED number to set state for
+ * @param State : true for on, false for off
+ * @return None
+ */
+void Board_LED_Set(uint8_t LEDNumber, bool State);
+
+/**
+ * @brief Returns the current state of a board LED
+ * @param LEDNumber : LED number to set state for
+ * @return true if the LED is on, otherwise false
+ */
+bool Board_LED_Test(uint8_t LEDNumber);
+
+/**
+ * @brief Toggles the current state of a board LED
+ * @param LEDNumber : LED number to change state for
+ * @return None
+ */
+void Board_LED_Toggle(uint8_t LEDNumber);
+
+/**
+ * @brief Function prototype for a MS delay function. Board layers or example code may
+ * define this function as needed.
+ */
+typedef void (*p_msDelay_func_t)(uint32_t);
+
+/* The DEBUG* functions are selected based on system configuration.
+ Code that uses the DEBUG* functions will have their I/O routed to
+ the UART, semihosting, or nowhere. */
+#if defined(DEBUG_ENABLE)
+#if defined(DEBUG_SEMIHOSTING)
+#define DEBUGINIT()
+#define DEBUGOUT(...) printf(__VA_ARGS__)
+#define DEBUGSTR(str) printf(str)
+#define DEBUGIN() (int) EOF
+
+#else
+#define DEBUGINIT() Board_Debug_Init()
+#define DEBUGOUT(...) printf(__VA_ARGS__)
+#define DEBUGSTR(str) Board_UARTPutSTR(str)
+#define DEBUGIN() Board_UARTGetChar()
+#endif /* defined(DEBUG_SEMIHOSTING) */
+
+#else
+#define DEBUGINIT()
+#define DEBUGOUT(...)
+#define DEBUGSTR(str)
+#define DEBUGIN() (int) EOF
+#endif /* defined(DEBUG_ENABLE) */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOARD_API_H_ */
diff -r 000000000000 -r e0042c0c4d2d board_sysinit.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/board_sysinit.c Tue Oct 28 12:20:47 2014 +0000
@@ -0,0 +1,97 @@
+/*
+ * @brief LPCXpresso 1347 Sysinit file
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "string.h"
+
+/* The System initialization code is called prior to the application and
+ initializes the board for run-time operation. Board initialization
+ includes clock setup and default pin muxing configuration. */
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/* Pin muxing table, only items that need changing from their default pin
+ state are in this table. */
+/*STATIC const PINMUX_GRP_T pinmuxing[] = {
+ { 0, 3, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7) }, // PIO0_3 used for USB_VBUS
+ { 0, 4, (IOCON_FUNC1 | IOCON_SFI2C_EN) }, // PIO0_4 used for SCL
+ { 0, 5, (IOCON_FUNC1 | IOCON_SFI2C_EN) }, // PIO0_5 used for SDA
+ { 0, 6, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7) }, // PIO0_6 used for USB_CONNECT
+ { 0, 11, (IOCON_FUNC1 | IOCON_DIGMODE_EN) }, // PIO0_11 used for GPIO
+ { 0, 12, (IOCON_FUNC1 | IOCON_DIGMODE_EN) }, // PIO0_12 used for GPIO
+ { 0, 13, (IOCON_FUNC3 | IOCON_DIGMODE_EN) }, // PIO0_13 used for CT32B1_MAT0
+ { 0, 14, (IOCON_FUNC1 | IOCON_DIGMODE_EN) }, // PIO0_14 used for GPIO
+ { 0, 10, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7) }, // PIO0_10 used for GPIO
+ { 0, 15, (IOCON_FUNC3 | IOCON_DIGMODE_EN) }, // PIO0_15 used for CT32B1_MAT2
+ { 1, 13, (IOCON_FUNC3 | IOCON_RESERVED_BIT_7) }, // PIO1_13 used for TXD
+ { 1, 14, (IOCON_FUNC3 | IOCON_RESERVED_BIT_7) }, // PIO1_14 used for RXD
+ { 1, 27, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7) }, // PIO1_27 used for CT32B0_MAT3
+};*/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Sets up system pin muxing */
+void Board_SetupMuxing(void)
+{
+ /* Enable IOCON clock */
+ //Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
+
+ //Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
+}
+
+/* Set up and initialize clocking prior to call to main */
+void Board_SetupClocking(void)
+{
+ //Chip_SetupXtalClocking();
+}
+
+/* Set up and initialize hardware prior to call to main */
+void Board_SystemInit(void)
+{
+ /* Booting from FLASH, so remap vector table to FLASH */
+ //Chip_SYSCTL_Map(REMAP_USER_FLASH_MODE);
+
+ /* Setup system clocking and muxing */
+ Board_SetupMuxing();
+ Board_SetupClocking();
+}