Nicholas Herriot
/
MMA8452_test
A test utility for mma8452
helperFunctions.cpp
- Committer:
- nherriot
- Date:
- 2013-10-17
- Revision:
- 7:2fa57cf76768
- Parent:
- 4:489573e65d47
File content as of revision 7:2fa57cf76768:
#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"); }