MMA8451Q driver

Fork of lib_mma8451q by canuck lehead

Revision:
6:828b08201d8b
Parent:
5:7bcda574c0fa
Parent:
4:b06535efa239
Child:
8:442c7e6e35ce
diff -r 7bcda574c0fa -r 828b08201d8b mma8451q.cpp
--- a/mma8451q.cpp	Fri Aug 12 13:26:13 2016 +0000
+++ b/mma8451q.cpp	Fri Aug 12 14:13:17 2016 +0000
@@ -227,38 +227,35 @@
         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.right = true;
                 if(verbose)
@@ -270,8 +267,9 @@
                 if(verbose)
                     printf("left ");
             }
+
             
-            if (pl_status.bits.BAFRO)
+            if (orientation.pl_status.bits.BAFRO)
             {
                 orientation.back = true;
                 if(verbose)