mma8451q driver with a few minor modifications
Fork of lib_mma8451q by
Diff: mma8451q.cpp
- Revision:
- 4:b06535efa239
- Parent:
- 3:96faac0d688e
- Child:
- 6:828b08201d8b
--- a/mma8451q.cpp Mon Mar 07 15:21:11 2016 -0500 +++ b/mma8451q.cpp Thu Aug 11 17:22:09 2016 -0400 @@ -227,51 +227,48 @@ read_single(MMA8451_PULSE_SRC); } if (int_src.bits.SRC_LNDPRT) { + /*AN4068 Step 12: Write a Service Routine to Service the Interrupt */ mma_pl_status_t pl_status; - /*AN4068 Step 12: Write a Service Routine to Service the Interrupt */ pl_status.octet = read_single(MMA8451_PL_STATUS); - if(verbose) - printf("PL_STATUS: "); - if (pl_status.bits.NEWLP) { orientation.reset(); + orientation.pl_status.octet = pl_status.octet; - if (pl_status.bits.LO) + if (orientation.pl_status.bits.LO) { orientation.low = true; if(verbose) printf("Z-tilt-LO "); } - - if (pl_status.bits.LAPO == 0) + if (orientation.pl_status.bits.LAPO == 0) { orientation.up = true; if(verbose) printf("up "); } - else if (pl_status.bits.LAPO == 1) + else if (orientation.pl_status.bits.LAPO == 1) { orientation.down = true; if(verbose) printf("down "); } - else if (pl_status.bits.LAPO == 2) + else if (orientation.pl_status.bits.LAPO == 2) { orientation.left = true; if(verbose) printf("left "); } - else if (pl_status.bits.LAPO == 3) + else if (orientation.pl_status.bits.LAPO == 3) { orientation.right = true; if(verbose) printf("right "); } - if (pl_status.bits.BAFRO) + if (orientation.pl_status.bits.BAFRO) { orientation.back = true; if(verbose)