Pulse Detection in z-axis

Dependencies:   MMA8451Q8b SLCD mbed

Fork of KL46z_single_tap_generic by Vishal Bharam

Revision:
10:92c7ff5198ee
Parent:
9:08acb96591a8
Child:
11:adb9adf636cf
--- a/main.cpp	Mon Feb 16 20:06:22 2015 +0000
+++ b/main.cpp	Tue Feb 17 03:49:09 2015 +0000
@@ -114,10 +114,7 @@
     sprintf (lcdData,"%x",regData);
     LCDMess(lcdData,BLINKTIME); 
     
-    
-    while (true) { 
-
-    // Read Pulse Source Data and check to see if things have been set
+// Read Pulse Source Data and check to see if things have been set
         acc.readRegs(REG_PULSE_CFG, &regData, 1);  // check it
         sprintf (lcdData,"%x",regData);
         LCDMess(lcdData,BLINKTIME); 
@@ -125,11 +122,11 @@
         regData = latchData | axisData;
         acc.setRegisterInStandby(REG_PULSE_CFG, regData); // write the data
         acc.readRegs(REG_PULSE_CFG, &regData, 1);  // check it
-        if (regData == 0xC0 || regData == 0xC4)
-            //z-axis event detected
         sprintf (lcdData,"%x",regData);
         LCDMess(lcdData,BLINKTIME); 
-                
+    
+    
+    while (true) {                  
         acc.readRegs(REG_PULSE_SRC, &regData, 1);
         sprintf (lcdData,"%x",regData);
         LCDMess(lcdData,BLINKTIME);