blackbox/lowlevel.c

changeset 0
9b7de464f0ea
child 2
6c59b4293fa9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/blackbox/lowlevel.c	Mon Nov 14 20:31:32 2011 +0100
@@ -0,0 +1,36 @@
+#include "stdint.h"
+#include "main.h"
+
+void LED(uint8_t num, uint8_t state) {
+    switch (num) {
+        case 1: switch (state) {
+            case 0: LED1_PORT &= ~_BV(LED1); break;
+            case 1: LED1_PORT |= _BV(LED1); break;
+            case 2: LED1_PORT ^= _BV(LED1); break;
+            } break;
+
+        case 2: switch (state) {
+            case 0: LED2_PORT &= ~_BV(LED2); break;
+            case 1: LED2_PORT |= _BV(LED2); break;
+            case 2: LED2_PORT ^= _BV(LED2); break;
+            } break;
+
+        case 3: switch (state) {
+            case 0: LED3_PORT &= ~_BV(LED3); break;
+            case 1: LED3_PORT |= _BV(LED3); break;
+            case 2: LED3_PORT ^= _BV(LED3); break;
+            } break;
+
+        case 4: switch (state) {
+            case 0: LED4_PORT &= ~_BV(LED4); break;
+            case 1: LED4_PORT |= _BV(LED4); break;
+            case 2: LED4_PORT ^= _BV(LED4); break;
+            } break;
+
+        case 5: switch (state) {
+            case 0: LED5_PORT &= ~_BV(LED5); break;
+            case 1: LED5_PORT |= _BV(LED5); break;
+            case 2: LED5_PORT ^= _BV(LED5); break;
+            } break;
+    }
+}

mercurial