uc-sdk
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
BoardInit.c
Go to the documentation of this file.
1
#include "
lpc17xx_gpio.h
"
2
#include "
lpc17xx_clkpwr.h
"
3
4
#define LED1_wire 18
5
#define LED2_wire 20
6
#define LED3_wire 21
7
#define LED4_wire 23
8
9
static
void
setupLEDs() {
10
GPIO_SetDir
(1, (1 <<
LED1_wire
) | (1 <<
LED2_wire
) | (1 <<
LED3_wire
) | (1 <<
LED4_wire
), 1);
11
}
12
13
static
void
litLED(
int
led,
int
value) {
14
if
((led > 4) || (led < 0))
15
return
;
16
17
switch
(led) {
18
case
1: led = 1 <<
LED1_wire
;
break
;
19
case
2: led = 1 <<
LED2_wire
;
break
;
20
case
3: led = 1 <<
LED3_wire
;
break
;
21
case
4: led = 1 <<
LED4_wire
;
break
;
22
}
23
24
if
(value) {
25
GPIO_SetValue
(1, led);
26
}
else
{
27
GPIO_ClearValue
(1, led);
28
}
29
}
30
31
32
33
extern
uintptr_t
__cs3_interrupt_vector_mutable
[];
34
35
void
BoardEarlyInit
() {
36
setupLEDs();
37
litLED(1, 1);
38
}
39
40
void
BoardInit
() {
41
litLED(2, 1);
42
}
43
44
void
BoardLateInit
() {
45
litLED(3, 1);
46
}
47
48
void
BoardShutdown
() {
49
}
50
51
void
BoardExceptionHandler
(
int
code) {
52
volatile
int
i;
53
for
(i = 0; i < 100000; i++);
54
CLKPWR_DeepPowerDown
();
55
}
arch
arm
lpc17xx
mbed
BoardInit.c
Generated on Fri Nov 15 2013 05:00:16 for uc-sdk by
1.8.4