Clemens Valens / board

Dependents:   kinetisizer

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers board.h Source File

board.h

00001 /*
00002  * @brief NXP LPCXpresso 1347 board file
00003  *
00004  * @note
00005  * Copyright(C) NXP Semiconductors, 2013
00006  * All rights reserved.
00007  *
00008  * @par
00009  * Software that is described herein is for illustrative purposes only
00010  * which provides customers with programming information regarding the
00011  * LPC products.  This software is supplied "AS IS" without any warranties of
00012  * any kind, and NXP Semiconductors and its licensor disclaim any and
00013  * all warranties, express or implied, including all implied warranties of
00014  * merchantability, fitness for a particular purpose and non-infringement of
00015  * intellectual property rights.  NXP Semiconductors assumes no responsibility
00016  * or liability for the use of the software, conveys no license or rights under any
00017  * patent, copyright, mask work right, or any other intellectual property rights in
00018  * or to any products. NXP Semiconductors reserves the right to make changes
00019  * in the software without notification. NXP Semiconductors also makes no
00020  * representation or warranty that such application will be suitable for the
00021  * specified use without further testing or modification.
00022  *
00023  * @par
00024  * Permission to use, copy, modify, and distribute this software and its
00025  * documentation is hereby granted, under NXP Semiconductors' and its
00026  * licensor's relevant copyrights in the software, without fee, provided that it
00027  * is used in conjunction with NXP Semiconductors microcontrollers.  This
00028  * copyright, permission, and disclaimer notice must appear in all copies of
00029  * this code.
00030  */
00031 
00032 #ifndef __BOARD_H_
00033 #define __BOARD_H_
00034 
00035 #include <stdint.h>
00036 #include <stdbool.h>
00037 
00038 #define STATIC static
00039 #define IOCON_FUNC0  (0)
00040 #define IOCON_FUNC1  (1)
00041 #define IOCON_FUNC2  (2)
00042 #define IOCON_FUNC3  (3)
00043 #define IOCON_RESERVED_BIT_7  (0)
00044 #define IOCON_SFI2C_EN  (1)
00045 #define IOCON_DIGMODE_EN  (2)
00046 #define IOCON_INV_EN  (3)
00047 #define IOCON_MODE_PULLUP  (4)
00048 
00049 //#include "chip.h"
00050 /* board_api.h is included at the bottom of this file after DEBUG setup */
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 /** @defgroup BOARD_NXP_LPCXPRESSO_1347 NXP LPC1347 Xpresso board support functions
00057  * @ingroup LPCOPEN_13XX_BOARD_LPCXPRESSO_1347
00058  * @{
00059  */
00060 
00061 /** @defgroup BOARD_NXP_LPCXPRESSO_1347_OPTIONS BOARD: NXP LPC1347 Xpresso board build options
00062  * This board has options that configure its operation at build-time.<br>
00063  * @{
00064  */
00065  
00066  /** Define DEBUG_ENABLE to enable IO via the DEBUGSTR, DEBUGOUT, and
00067     DEBUGIN macros. If not defined, DEBUG* functions will be optimized
00068     out of the code at build time.
00069  */
00070 //#define DEBUG_ENABLE
00071 
00072 /** Define DEBUG_SEMIHOSTING along with DEBUG_ENABLE to enable IO support
00073     via semihosting. You may need to use a C library that supports
00074     semihosting with this option.
00075  */
00076 //#define DEBUG_SEMIHOSTING
00077 
00078 /** Board UART used for debug output and input using the DEBUG* macros. This
00079     is also the port used for Board_UARTPutChar, Board_UARTGetChar, and
00080     Board_UARTPutSTR functions.
00081  */
00082 #define DEBUG_UART LPC_USART
00083 
00084 /**
00085  * @}
00086  */
00087 
00088 /* Board name */
00089 #define BOARD_ELEKTOR_140182
00090 
00091 #define OUTPUT  true
00092 #define INPUT  false
00093 
00094 // LED(s).
00095 #define BOARD_LED1_GREEN_PORT  (0)
00096 #define BOARD_LED1_GREEN_PIN  (18)
00097 #define BOARD_LED1_RED_PORT  (0)
00098 #define BOARD_LED1_RED_PIN  (9)
00099 #define BOARD_LED2_GREEN_PORT  (0)
00100 #define BOARD_LED2_GREEN_PIN  (10)
00101 #define BOARD_LED2_RED_PORT  (0)
00102 #define BOARD_LED2_RED_PIN  (8)
00103 #define BOARD_LED3_PORT  (1)
00104 #define BOARD_LED3_PIN  (31)
00105 #define BOARD_LED1_GREEN  (0)
00106 #define BOARD_LED1_RED  (1)
00107 #define BOARD_LED2_GREEN  (2)
00108 #define BOARD_LED2_RED  (3)
00109 #define BOARD_LED3  (4)
00110 #define BOARD_LED_OFF  (true)
00111 #define BOARD_LED_ON  (false)
00112 // The other LED function prototypes are in board_api.h
00113 void Board_LED_Init(void);
00114 
00115 
00116 // LCD (2x16) with I2C interface, based on ST7032i chip.
00117 #define BOARD_LCD_LINES  (2)
00118 #define BOARD_LCD_CHARS_PER_LINE  (16)
00119 #define BOARD_LCD_RESET_PORT  (1)
00120 #define BOARD_LCD_RESET_PIN  (15)
00121 #define BOARD_LCD_RESET_ON  (0)
00122 #define BOARD_LCD_RESET_OFF  (1)
00123 #define BOARD_LCD_BACKLIGHT_PORT  (1)
00124 #define BOARD_LCD_BACKLIGHT_PIN  (16)
00125 #define BOARD_LCD_BACKLIGHT_ON  (0)
00126 #define BOARD_LCD_BACKLIGHT_OFF  (1)
00127 void Board_LCD_Init(void);
00128 void Board_LCD_ResetAssert(void);
00129 void Board_LCD_ResetDeassert(void);
00130 void Board_LCD_SetBacklight(uint8_t Intensity);
00131 
00132 
00133 // Keyboard.
00134 #define BOARD_KEYBOARD_R0_PORT  (1)
00135 #define BOARD_KEYBOARD_R0_PIN  (23)
00136 #define BOARD_KEYBOARD_R1_PORT  (1)
00137 #define BOARD_KEYBOARD_R1_PIN  (24)
00138 #define BOARD_KEYBOARD_R2_PORT  (1)
00139 #define BOARD_KEYBOARD_R2_PIN  (25)
00140 #define BOARD_KEYBOARD_C0_PORT  (1)
00141 #define BOARD_KEYBOARD_C0_PIN  (26)
00142 #define BOARD_KEYBOARD_C1_PORT  (1)
00143 #define BOARD_KEYBOARD_C1_PIN  (28)
00144 #define BOARD_KEYBOARD_C2_PORT  (1)
00145 #define BOARD_KEYBOARD_C2_PIN  (29)
00146 
00147 #define BOARD_KEYBOARD_ISP_PORT  (0)
00148 #define BOARD_KEYBOARD_ISP_PIN  (1)
00149 
00150 #define BOARD_KEYBOARD_RESET_PORT  (0)
00151 #define BOARD_KEYBOARD_RESET_PIN  (0)
00152 // Uncomment if you don't need a reset pin in your system.
00153 //#define RESET_IS_GPIO
00154 
00155 // ---------------------------------------------------
00156 //  Keys.
00157 // ---------------------------------------------------
00158 #define BOARD_KEYBOARD_S00  (0)  /* S1 push */
00159 #define BOARD_KEYBOARD_S01  (1)  /* S2 push */
00160 #define BOARD_KEYBOARD_S02  (2)  /* S3 push */
00161 #define BOARD_KEYBOARD_S10  (3)  /* S4 push */
00162 #define BOARD_KEYBOARD_S11  (4)  /* S5 push */
00163 #define BOARD_KEYBOARD_S12  (5)  /* S6 push */
00164 #define BOARD_KEYBOARD_S20  (6)  /* S7 push */
00165 #define BOARD_KEYBOARD_S21  (7)  /* S8 push */
00166 #define BOARD_KEYBOARD_S22  (8)  /* S11 (spare) */
00167 #define BOARD_KEYBOARD_ISP  (9)  /* S9 */
00168 #if defined RESET_IS_GPIO
00169 #define BOARD_KEYBOARD_RESET  (10)  /* S10 */
00170 #endif
00171 // Other non-matrix keys go here.
00172 
00173 // --------------------------------------------------------------
00174 //  Rotary encoders.
00175 // --------------------------------------------------------------
00176 #define BOARD_KEYBOARD_RE0  /* S1 */
00177 #define BOARD_KEYBOARD_RE1  /* S2 */
00178 #define BOARD_KEYBOARD_RE2  /* S3 */
00179 #define BOARD_KEYBOARD_RE3  /* S4 */
00180 #define BOARD_KEYBOARD_RE4  /* S5 */
00181 #define BOARD_KEYBOARD_RE5  /* S6 */
00182 #define BOARD_KEYBOARD_RE6  /* S7 */
00183 #define BOARD_KEYBOARD_RE7  /* S8 */
00184 
00185 #if defined(BOARD_KEYBOARD_RE0)  /* S1 */
00186 #define BOARD_KEYBOARD_RE0_A_PORT  (1)
00187 #define BOARD_KEYBOARD_RE0_A_PIN  (19)
00188 #define BOARD_KEYBOARD_RE0_B_PORT  (1)
00189 #define BOARD_KEYBOARD_RE0_B_PIN  (20)
00190 #endif
00191 
00192 #if defined(BOARD_KEYBOARD_RE1)  /* S2 */
00193 #define BOARD_KEYBOARD_RE1_A_PORT  (1)
00194 #define BOARD_KEYBOARD_RE1_A_PIN  (21)
00195 #define BOARD_KEYBOARD_RE1_B_PORT  (1)
00196 #define BOARD_KEYBOARD_RE1_B_PIN  (22)
00197 #endif
00198 
00199 #if defined(BOARD_KEYBOARD_RE2)  /* S3 */
00200 #define BOARD_KEYBOARD_RE2_A_PORT  (0)
00201 #define BOARD_KEYBOARD_RE2_A_PIN  (2)
00202 #define BOARD_KEYBOARD_RE2_B_PORT  (0)
00203 #define BOARD_KEYBOARD_RE2_B_PIN  (11)
00204 #endif
00205 
00206 #if defined(BOARD_KEYBOARD_RE3)  /* S4 */
00207 #define BOARD_KEYBOARD_RE3_A_PORT  (0)
00208 #define BOARD_KEYBOARD_RE3_A_PIN  (7)
00209 #define BOARD_KEYBOARD_RE3_B_PORT  (0)
00210 #define BOARD_KEYBOARD_RE3_B_PIN  (12)
00211 #endif
00212 
00213 #if defined(BOARD_KEYBOARD_RE4)  /* S5 */
00214 #define BOARD_KEYBOARD_RE4_A_PORT  (0)
00215 #define BOARD_KEYBOARD_RE4_A_PIN  (17)
00216 #define BOARD_KEYBOARD_RE4_B_PORT  (0)
00217 #define BOARD_KEYBOARD_RE4_B_PIN  (14)
00218 #endif
00219 
00220 #if defined(BOARD_KEYBOARD_RE5)  /* S6 */
00221 #define BOARD_KEYBOARD_RE5_A_PORT  (0)
00222 #define BOARD_KEYBOARD_RE5_A_PIN  (19)
00223 #define BOARD_KEYBOARD_RE5_B_PORT  (0)
00224 #define BOARD_KEYBOARD_RE5_B_PIN  (16)
00225 #endif
00226 
00227 #if defined(BOARD_KEYBOARD_RE6)  /* S7 */
00228 #define BOARD_KEYBOARD_RE6_A_PORT  (0)
00229 #define BOARD_KEYBOARD_RE6_A_PIN  (20)
00230 #define BOARD_KEYBOARD_RE6_B_PORT  (0)
00231 #define BOARD_KEYBOARD_RE6_B_PIN  (22)
00232 #endif
00233 
00234 #if defined(BOARD_KEYBOARD_RE7)  /* S8 */
00235 #define BOARD_KEYBOARD_RE7_A_PORT  (0)
00236 #define BOARD_KEYBOARD_RE7_A_PIN  (21)
00237 #define BOARD_KEYBOARD_RE7_B_PORT  (0)
00238 #define BOARD_KEYBOARD_RE7_B_PIN  (23)
00239 #endif
00240 
00241 #define BOARD_KEYBOARD_REPEAT_DELAY  (500) /* [ms] */
00242 #define BOARD_KEYBOARD_REPEAT_RATE  (100) /* [ms] */
00243 #define BOARD_KEYBOARD_DOUBLE_CLICK_MIN (100)  /* [ms] */
00244 #define BOARD_KEYBOARD_DOUBLE_CLICK_MAX (BOARD_KEYBOARD_DOUBLE_CLICK_MIN+300)  /* [ms] */
00245 
00246 
00247 /**
00248  * Button defines
00249  */
00250 #define BUTTONS_BUTTON1     0x01
00251 #define NO_BUTTON_PRESSED   0x00
00252 
00253 
00254 /**
00255  * @brief   Initialize buttons on the board
00256  * @return  Nothing
00257  */
00258 void Board_Buttons_Init(void);
00259 
00260 /**
00261  * @brief   Get button status
00262  * @return  status of button
00263  */
00264 uint32_t Buttons_GetStatus(void);
00265 
00266 /**
00267  * @brief   Sets up board specific ADC interface
00268  * @return  Nothing
00269  */
00270 void Board_ADC_Init(void);
00271 
00272 typedef uint32_t LPC_SSP_T;
00273 #define LPC_SSP0 ((uint32_t*)0)
00274 /**
00275  * @brief   Initialize pin muxing for SSP interface
00276  * @param   pSSP    : Pointer to SSP interface to initialize
00277  * @return  Nothing
00278  */
00279 void Board_SSP_Init(LPC_SSP_T *pSSP);
00280 
00281 /**
00282  * @}
00283  */
00284 
00285 #include "board_api.h"
00286 
00287 #ifdef __cplusplus
00288 }
00289 #endif
00290 
00291 #endif /* __BOARD_H_ */