summaryrefslogtreecommitdiff
path: root/demo.c
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-25 04:16:01 +0100
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-25 04:16:01 +0100
commit9a836f1dbf90f07c2fc4151166f7456879d675b0 (patch)
treebc7eec0850c1249c32465b41607a293c50eed44e /demo.c
parentfcef19baed9cb5b040a3df0505e57710df20ee43 (diff)
Making the compiler a bitch by enabling warnings in full, fixing a few warnings, and making the board actually do slightly something.
Diffstat (limited to 'demo.c')
-rw-r--r--demo.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/demo.c b/demo.c
index 7f2a174..5fe57cb 100644
--- a/demo.c
+++ b/demo.c
@@ -1,6 +1,42 @@
#include <FreeRTOS.h>
#include <task.h>
+#include <debug_frmwrk.h>
+#include <lpc17xx_gpio.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);
+}
+
+void litLED(int led, int value) {
+ if ((led >= 4) || (led < 0))
+ return;
+
+ switch (led) {
+ case 1: led = LED1_wire; break;
+ case 2: led = LED2_wire; break;
+ case 3: led = LED3_wire; break;
+ case 4: led = LED4_wire; break;
+ }
+
+ if (value) {
+ GPIO_SetValue(1, led);
+ } else {
+ GPIO_ClearValue(1, led);
+ }
+}
int main() {
+ debug_frmwrk_init();
+ setupLEDs();
+ litLED(1, 1);
+ litLED(2, 0);
+ litLED(3, 1);
+ litLED(4, 0);
vTaskStartScheduler();
+ return 0;
}