A test utility for mma8452

Dependencies:   MMA8452 mbed

Revision:
4:489573e65d47
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/helperFunctions.cpp	Wed Oct 16 14:12:28 2013 +0000
@@ -0,0 +1,24 @@
+
+#include "helperFunctions.h"
+
+//Serial pc(USBTX, USBRX);
+
+// This function will print a 7 bit char as a binary number on the screen
+void printbincharpad(char c)
+{
+    for (int i = 7; i >= 0; --i)
+    {
+        putchar( (c & (1 << i)) ? '1' : '0' );
+        if (i==4){putchar(':');}
+    }
+    
+}
+
+// This function will take two characters and print formatted as a binary number on the screen
+void print2bytebinchar(char *buffer)
+{
+    printbincharpad(buffer[0]);
+    printf(" -- ");
+    printbincharpad(buffer[1]);
+    printf("\n");
+}