simple test program to demonstrate a (random) stalling of the mbed on a call to the interface chip

Dependencies:   mbed

Revision:
0:fcbed0c42196
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 21 05:04:32 2015 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+
+#include "Watchdog.h"
+
+extern "C" void mbed_mac_address(char *);
+
+int main() {
+    
+    DigitalOut led1(LED1,1);
+    
+    Watchdog::kick(15);
+
+    DigitalOut led2(LED2,1);
+    DigitalOut led3(LED3,0);
+    DigitalOut led4(LED4,0);
+
+    // show result of interface_connected via LEDs
+    if (mbed_interface_connected()) {
+        led4 = 1;
+    } else {
+        led3 = 1;
+    }
+    
+    // may stall here if M0 chip not available
+    static const uint8_t b64 = sizeof(uint64_t);
+    static char c[b64];
+    mbed_mac_address(&(c[0]));
+
+    // turn off led1 to indicate we made it here
+    led1 = 0;
+    
+    // reset quickly    
+    Watchdog::kick(2);
+    while(true) {
+        // blink to show we're running
+        led2 = !led2;
+        wait(0.1);
+    }
+}