summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/lpc17xx/mbed/BoardInit.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/lpc17xx/mbed/BoardInit.c b/arch/arm/lpc17xx/mbed/BoardInit.c
index 968e723..67e0732 100644
--- a/arch/arm/lpc17xx/mbed/BoardInit.c
+++ b/arch/arm/lpc17xx/mbed/BoardInit.c
@@ -1,13 +1,47 @@
+#include "lpc17xx_gpio.h"
#include "lpc17xx_nvic.h"
#include "lpc17xx_clkpwr.h"
+#define LED1_wire 18
+#define LED2_wire 20
+#define LED3_wire 21
+#define LED4_wire 23
+
+static void setupLEDs() {
+ GPIO_SetDir(1, (1 << LED1_wire) | (1 << LED2_wire) | (1 << LED3_wire) | (1 << LED4_wire), 1);
+}
+
+static void litLED(int led, int value) {
+ if ((led > 4) || (led < 0))
+ return;
+
+ switch (led) {
+ case 1: led = 1 << LED1_wire; break;
+ case 2: led = 1 << LED2_wire; break;
+ case 3: led = 1 << LED3_wire; break;
+ case 4: led = 1 << LED4_wire; break;
+ }
+
+ if (value) {
+ GPIO_SetValue(1, led);
+ } else {
+ GPIO_ClearValue(1, led);
+ }
+}
+
+
+
extern uintptr_t __cs3_interrupt_vector_mutable[];
void BoardEarlyInit() {
+ setupLEDs();
+ litLED(1, 1);
NVIC_SetVTOR((uintptr_t) __cs3_interrupt_vector_mutable);
+ litLED(2, 1);
}
void BoardLateInit() {
+ litLED(3, 1);
}
void BoardShutdown() {