Basis for the C2 protocol from Silicon Labs.

Dependencies:   mbed

Revision:
6:deb670cb8105
Parent:
5:53d4a67cd657
Child:
7:65a72aad87b8
--- a/main.cpp	Sun May 25 14:01:14 2014 +0000
+++ b/main.cpp	Sun May 25 17:11:20 2014 +0000
@@ -66,6 +66,10 @@
     { NULL, 0 }
 };
 
+#define C2_MASK_FLBUSY      0x80
+#define C2_MASK_INBUSY      0x02
+#define C2_MASK_OUTREADY    0x01
+
 #define C2_DEVID    0
 #define C2_REVID    1
 #define C2_FPCTL    2
@@ -177,6 +181,15 @@
     exit(1);
 }
 
+static int poll_status(int mask) {
+    int t = 20;
+    do {
+        if (!(c2_read_ar() & mask)) return 0;
+        wait_us(1);
+    } while(--t);
+    return -1;
+}
+        
 int main() {
     int i, c, devid, revid;