Basis for the C2 protocol from Silicon Labs.

Dependencies:   mbed

Revision:
3:b30605f1c435
Parent:
2:9092d0d1558b
Child:
4:a9e3ee5741be
--- a/main.cpp	Sat May 24 12:34:13 2014 +0000
+++ b/main.cpp	Sat May 24 12:50:30 2014 +0000
@@ -142,8 +142,14 @@
     STOP;
 }
 
+static void fatal(char *s) {
+    puts(s);
+loop:
+    goto loop;
+}
+
 int main() {
-    int c;
+    int c, devid, revid;
     
     c2d.input();
     c2ck = 1;
@@ -153,6 +159,14 @@
     printf("Press any key to continue\n\r");
     
     c = getc(stdin);
+
+    c2_write_ar(0x00);
+    devid = c2_read_dr();
+    if (devid < 0) fatal("unable to read devid\n\r");
     
-    printf("\n\rHello, world\n\r");
+    c2_write_ar(0x01);
+    revid = c2_read_dr();
+    if (revid < 0) fatal("unable to read revid\n\r");
+
+    printf("devid:revid = %02x:%02x\n\r", devid, revid);
 }