LPCOpen Platform for LPC18XX/43XX microcontrollers  18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
board.c
Go to the documentation of this file.
1 /*
2  * @brief Hitex EVA 1850/4350 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 #include "board.h"
33 #include "string.h"
34 
35 /* Include other sources files specific to this board */
36 #include "retarget.h"
37 
42 /*****************************************************************************
43  * Private types/enumerations/variables
44  ****************************************************************************/
45 #define LED0_PORT 0
46 #define LED0_PIN 8
47 
48 /*****************************************************************************
49  * Public types/enumerations/variables
50  ****************************************************************************/
51 
52 /* System configuration variables used by chip driver */
53 const uint32_t ExtRateIn = 0;
54 const uint32_t OscRateIn = 12000000;
55 
56 /*****************************************************************************
57  * Private functions
58  ****************************************************************************/
59 
60 /*****************************************************************************
61  * Public functions
62  ****************************************************************************/
63 
64 /* Initialize pin muxing for a UART */
66 {
67  if (pUART == LPC_USART0) {
68  }
69  else if (pUART == LPC_UART1) {
70  }
71  else if (pUART == LPC_USART2) {
72  /* P2.10 : UART2_TXD J3 -> Pin 8, P2.11 : UART2_RXD -> J3 Pin-7*/
75  }
76  else if (pUART == LPC_USART3) {
77  }
78 }
79 
80 /* Initialize debug output via UART for board */
81 void Board_Debug_Init(void)
82 {
83 #if defined(DEBUG_UART)
85 
89 
90  /* Enable UART Transmit */
92 #endif
93 }
94 
95 /* Sends a character on the UART */
96 void Board_UARTPutChar(char ch)
97 {
98 #if defined(DEBUG_UART)
99  /* Wait for space in FIFO */
101  Chip_UART_SendByte(DEBUG_UART, (uint8_t) ch);
102 #endif
103 }
104 
105 /* Gets a character from the UART, returns EOF if no character is ready */
107 {
108 #if defined(DEBUG_UART)
110  return (int) Chip_UART_ReadByte(DEBUG_UART);
111  }
112 #endif
113  return EOF;
114 }
115 
116 /* Outputs a string on the debug UART */
117 void Board_UARTPutSTR(const char *str)
118 {
119 #if defined(DEBUG_UART)
120  while (*str != '\0') {
121  Board_UARTPutChar(*str++);
122  }
123 #endif
124 }
125 
126 /* Initializes board LED(s) */
127 static void Board_LED_Init()
128 {
129  /* Set ports as outputs with initial states off */
132 }
133 
134 /* Sets the state of a board LED to on or off */
135 void Board_LED_Set(uint8_t LEDNumber, bool On)
136 {
137  /* Must connect JP3 to see LED0 and JP4 to see LED1 */
138  if (LEDNumber == 0) {
140  }
141 }
142 
143 /* Returns the current state of a board LED */
144 bool Board_LED_Test(uint8_t LEDNumber)
145 {
146  bool On = false;
147 
148  if (LEDNumber == 0)
150 
151  return On;
152 }
153 
154 void Board_LED_Toggle(uint8_t LEDNumber)
155 {
156  Board_LED_Set(LEDNumber, !Board_LED_Test(LEDNumber));
157 }
158 
159 
160 /* Set up and initialize all required blocks and functions related to the
161  board hardware */
162 void Board_Init(void)
163 {
164  /* Sets up DEBUG UART */
165  DEBUGINIT();
166 
167  /* Initializes GPIO */
169 
170  /* Initialize LEDs */
171  Board_LED_Init();
172 }
173 
174 /* Sets up board specific ADC interface */
175 void Board_ADC_Init(void)
176 {
177  /* Analog function ADC1_2 selected on pin PF_9 */
179 }
180 
181 /* Sets up board specific I2C interface */
183 {
184  if (id == I2C1) {
185  /* Configure pin function for I2C1 on PE.13 (I2C1_SDA) and PE.15 (I2C1_SCL) */
188  }
189  else {
191  }
192 }
193 
194 /* Initialize pin muxing for SSP interface */
196 {
197  if (pSSP == LPC_SSP0) {
198  /* Not available on the board */
199  while (1) {}
200  }
201  else if (pSSP == LPC_SSP1) {
202  /* Set up clock and muxing for SSP1 interface */
203  /* SSEL: P1.20: J3 PIN-6 [Serial Expansion Interface] */
205  /* MISO: P1.3: J3 PIN-5 [Serial Expansion Interface] */
207  /* MOSI: P1.4: J3 PIN-4 [Serial Expansion Interface] */
209  /* SCLK: PF.4: J3 PIN-3 [Serial Expansion Interface] */
211  }
212 }
213 
214 /* Initialize DAC interface for the board */
216 {
218 }
219 
220 void Board_Buttons_Init(void) // FIXME not functional ATM
221 {
222 }
223 
224 uint32_t Buttons_GetStatus(void)
225 {
226  uint8_t ret = NO_BUTTON_PRESSED;
227  return ret;
228 }
229 
230 /* Initialize joystick interface on board */
232 {}
233 
234 /* Returns joystick states on board */
235 uint8_t Joystick_GetStatus(void)
236 {
237  return NO_BUTTON_PRESSED;
238 }
239