16 #include "simpletools.h" 20 #define MMA7455_readMask ~(1 << 6) // Read mask for clearing bit 6 23 int MMA7455_pinDat, MMA7455_pinClk, MMA7455_pinEn;
24 int MMA7455_gRangeVal;
27 unsigned char MMA7455_readByte(
unsigned char address)
30 int cmd = address & MMA7455_readMask;
31 shift_out(MMA7455_pinDat, MMA7455_pinClk, MSBFIRST, 7, cmd);
32 shift_out(MMA7455_pinDat, MMA7455_pinClk, MSBFIRST, 1, 0b0);
33 unsigned char result = shift_in(MMA7455_pinDat, MMA7455_pinClk, MSBPRE, 8);