LPCOpen Platform
v1.03
LPCOpen Platform for NXP LPC Microcontrollers
Main Page
Modules
Data Structures
Files
Related Pages
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
board_nxp_xpresso_11c24.c
Go to the documentation of this file.
1
/*
2
* @brief NXP XPRESSO 11C24 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
38
/*****************************************************************************
39
* Private types/enumerations/variables
40
****************************************************************************/
41
42
/*****************************************************************************
43
* Public types/enumerations/variables
44
****************************************************************************/
45
46
/* System Clock Frequency (Core Clock) */
47
uint32_t
SystemCoreClock
;
48
49
/*****************************************************************************
50
* Private functions
51
****************************************************************************/
52
53
/*****************************************************************************
54
* Public functions
55
****************************************************************************/
56
57
void
Board_UART_Init
(
void
)
58
{
59
/* Pin Muxing has already been done during the system init */
60
}
61
62
/* Sends a character on the UART */
63
void
Board_UARTPutChar
(
char
ch)
64
{
65
#if defined(DEBUG_ENABLE)
66
/* Wait for space in FIFO */
67
while
((
IP_UART_ReadLineStatus
(
DEBUG_UART
) &
UART_LSR_THRE
) == 0);
68
Chip_UART_SendByte
(
DEBUG_UART
, (uint8_t) ch);
69
#endif
70
}
71
72
/* Gets a character from the UART, returns EOF if no character is ready */
73
int
Board_UARTGetChar
(
void
)
74
{
75
#if defined(DEBUG_ENABLE)
76
if
(
Chip_UART_ReadLineStatus
(
DEBUG_UART
) &
UART_LSR_RDR
) {
77
return
(
int
)
Chip_UART_ReadByte
(
DEBUG_UART
);
78
}
79
#endif
80
return
EOF
;
81
}
82
83
/* Outputs a string on the debug UART */
84
void
Board_UARTPutSTR
(
char
*str)
85
{
86
#if defined(DEBUG_ENABLE)
87
while
(*str !=
'\0'
) {
88
Board_UARTPutChar
(*str++);
89
}
90
#endif
91
}
92
93
/* Initialize debug output via UART for board */
94
void
Board_Debug_Init
(
void
)
95
{
96
#if defined(DEBUG_ENABLE)
97
Board_UART_Init
();
98
99
/* Setup UART for 115.2K8N1 */
100
Chip_UART_Init
(
LPC_USART
);
101
Chip_UART_SetBaud
(
LPC_USART
, 115200);
102
Chip_UART_ConfigData
(
LPC_USART
, (
UART_LCR_WLEN8
|
UART_LCR_SBS_1BIT
));
103
Chip_UART_SetupFIFOS
(
LPC_USART
, (
UART_FCR_FIFO_EN
|
UART_FCR_TRG_LEV2
));
104
Chip_UART_TXEnable
(
LPC_USART
);
105
#endif
106
}
107
108
/* Initializes board LED(s) */
109
static
void
Board_LED_Init
(
void
)
110
{
111
/* Set the PIO_7 as output */
112
Chip_GPIO_WriteDirBit
(
LPC_GPIO_PORT
, 0, 7,
true
);
113
}
114
115
/* Sets the state of a board LED to on or off */
116
void
Board_LED_Set
(uint8_t LEDNumber,
bool
On
)
117
{
118
if
(LEDNumber == 0)
119
Chip_GPIO_WritePortBit
(
LPC_GPIO_PORT
, 0, 7, On);
120
}
121
122
/* Returns the current state of a board LED */
123
bool
Board_LED_Test
(uint8_t LEDNumber)
124
{
125
return
Chip_GPIO_ReadPortBit
(
LPC_GPIO_PORT
, 0, 7);
126
}
127
128
/* Update system core clock rate, should be called if the system has
129
a clock rate change */
130
void
SystemCoreClockUpdate
(
void
)
131
{
132
/* CPU core speed */
133
SystemCoreClock
=
Chip_Clock_GetSystemClockRate
();
134
}
135
136
/* Set up and initialize all required blocks and functions related to the
137
board hardware */
138
void
Board_Init
(
void
)
139
{
140
/* Sets up DEBUG UART */
141
DEBUGINIT
();
142
143
/* Updates SystemCoreClock global var with current clock speed */
144
SystemCoreClockUpdate
();
145
146
/* Initialize GPIO */
147
Chip_GPIO_Init
(
LPC_GPIO_PORT
);
148
149
/* Initialize LEDs */
150
Board_LED_Init
();
151
}
152
153
void
Board_SSP_Init
(
void
)
154
{
155
Chip_IOCON_PinLocSel
(
LPC_IOCON
,
IOCON_SCKLOC_PIO2_11
);
156
}
157
158
/* Configure pin for ADC channel 0 */
159
void
Board_ADC_Init
()
160
{
161
Chip_IOCON_PinMuxSet
(
LPC_IOCON
,
IOCON_PIO0_11
, 0x2);
162
}
163
software
lpc_core
lpc_board
boards_11xx
nxp_xpresso_11c24
board_nxp_xpresso_11c24.c
Generated on Fri May 10 2013 10:42:10 for LPCOpen Platform by
1.8.2