LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
board_keil_mcb_18574357.h
Go to the documentation of this file.
1 /*
2  * @brief Keil MCB 1857/4357 board file
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __BOARD_KEIL_MCB_18574357_H_
33 #define __BOARD_KEIL_MCB_18574357_H_
34 
35 #include "chip.h"
36 #include "board_api.h"
37 #include "lpc_phy.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
77 #define BOARD_KEIL_MCB_18574357
78 
79 #define LED_NUMBER_OF 1
80 
81 #define BUTTONS_BUTTON1_GPIO_PORT_NUM 2
82 #define BUTTONS_BUTTON1_GPIO_BIT_NUM 0
83 #define JOYSTICK_UP_GPIO_PORT_NUM 6
84 #define JOYSTICK_UP_GPIO_BIT_NUM 10
85 #define JOYSTICK_DOWN_GPIO_PORT_NUM 6
86 #define JOYSTICK_DOWN_GPIO_BIT_NUM 11
87 #define JOYSTICK_LEFT_GPIO_PORT_NUM 6
88 #define JOYSTICK_LEFT_GPIO_BIT_NUM 12
89 #define JOYSTICK_RIGHT_GPIO_PORT_NUM 6
90 #define JOYSTICK_RIGHT_GPIO_BIT_NUM 13
91 #define JOYSTICK_PRESS_GPIO_PORT_NUM 6
92 #define JOYSTICK_PRESS_GPIO_BIT_NUM 8
93 
94 #define JOY_UP 0x01
95 #define JOY_DOWN 0x02
96 #define JOY_LEFT 0x04
97 #define JOY_RIGHT 0x08
98 #define JOY_PRESS 0x10
99 #define NO_BUTTON_PRESSED 0x00
100 
101 #define BUTTONS_BUTTON1 0x01
102 
103 #define LEDS_LED1 0x01
104 #define LEDS_LED2 0x02
105 #define LEDS_LED3 0x04
106 #define LEDS_LED4 0x08
107 #define LEDS_NO_LEDS 0x00
108 
110 #define UDA1380_REG_EVALCLK_DEFAULT_VALUE (0xF << 8 | 0x3 << 4 | 1 << 1)
111 #define UDA1380_REG_I2S_DEFAULT_VALUE 0x0000
112 
113 #define UDA1380_REG_PWRCTRL_DEFAULT_VALUE (1 << 15 | 1 << 13 | 1 << 10 | 1 << 8 | 1 << 6 | 1 << 4 | 0x0F)
114 #define UDA1380_REG_ANAMIX_DEFAULT_VALUE 0x0000
115 #define UDA1380_REG_HEADAMP_DEFAULT_VALUE ( 1 << 9 | 2)
116 
117 #define UDA1380_REG_MSTRVOL_DEFAULT_VALUE 0x0000
118 #define UDA1380_REG_MIXVOL_DEFAULT_VALUE 0x0000
119 #define UDA1380_REG_MODEBBT_DEFAULT_VALUE 0x0000
120 #define UDA1380_REG_MSTRMUTE_DEFAULT_VALUE (2 << 8 | 2)
121 #define UDA1380_REG_MIXSDO_DEFAULT_VALUE 0x0000
122 
123 #define UDA1380_REG_DECVOL_DEFAULT_VALUE 0xE4E4 /* Decrease Volume -28dB */
124 #define UDA1380_REG_PGA_DEFAULT_VALUE 0x0000
125 #define UDA1380_REG_ADC_DEFAULT_VALUE 0x0001 /* Apply 0bB VGA Gain, enable DC Filter */
126 #define UDA1380_REG_AGC_DEFAULT_VALUE 0x0000
127 
128 #define UDA1380_REG_L3_DEFAULT_VALUE 0x0000
129 
130 /* UDA1380 address */
131 #define I2CDEV_UDA1380_ADDR (0x34 >> 1)
132 
133 /* UDA1380 Register Address */
134 typedef enum {
150 } UDA1380_REG;
151 
152 /* Frame buffer address for lcd */
153 #define FRAMEBUFFER_ADDR 0x28000000
154 
155 extern const LCD_Config_Type MCB4300_LCD;
156 #define BOARD_LCD MCB4300_LCD
157 
159 typedef enum {
160  MCB_18XX_AUDIO_MIC_SELECT = 1 << 2 | 1 << 3,
163 
165 #define SSP_ID LPC_SSP0
166 #define C_GLCD_H_SIZE 240
167 #define C_GLCD_V_SIZE 320
168 
171 #define TSC_I2C_ADDR (0x82 >> 1) /* Touchscreen 7-bit I2C address */
172 
174 #define SYS_CTRL1 0x03
175 #define SYS_CTRL2 0x04
176 #define INT_CTRL 0x09
177 #define INT_EN 0x0A
178 #define INT_STA 0x0B
179 #define GPIO_ALT_FUNCT 0x17
180 #define ADC_CTRL1 0x20
181 #define ADC_CTRL2 0x21
182 #define TSC_CTRL 0x40
183 #define TSC_CFG 0x41
184 #define FIFO_TH 0x4A
185 #define FIFO_STA 0x4B
186 #define FIFO_SIZE 0x4C
187 #define DATA_X 0x4D
188 #define DATA_Y 0x4F
189 #define DATA_Z 0x51
190 #define TSC_FRACTION_Z 0x56
191 #define TSC_I_DRIVE 0x58
192 #define TSC_SHIELD 0x59
193 #define DATA_XYZ 0xD7
194 
199 void Board_ADC_Init(void);
200 
206 void Board_I2C_Init(LPC_I2C_Type *I2Cx);
207 
212 void Board_GPIO_Int_Init(void);
213 
218 void Board_SDMMC_Init(void);
219 
225 void Board_SSP_Init(LPC_SSP_Type *SSPx);
226 
232 void Board_ENET_GetMacADDR(uint8_t *mcaddr);
233 
239 void Board_UART_Init(LPC_USART_Type *UARTx);
240 
245 void Board_LCD_Init(void);
246 
251 void Init_Touch_Controller(void);
252 
259 bool GetTouchPos(int16_t *pX, int16_t *pY);
260 
265 void Board_Buttons_Init (void);
266 
271 void Board_Joystick_Init (void);
272 
277 uint8_t Joystick_GetStatus (void);
278 
284 
292 
293 //FIXME Should we remove this function?
294 void Serial_CreateStream(void *Stream);
295 
300 #ifdef __cplusplus
301 }
302 #endif
303 
304 #endif /* __BOARD_KEIL_MCB_18574357_H_ */