Use accelerometer to interrupt.

Dependencies:   mbed SDFileSystem

Fork of shomberg_hw_7 by Russell Shomberg

Revision:
29:d33071ffaa5f
Parent:
28:a59485b1626b
--- a/MMA8452Q.cpp	Fri Nov 16 19:53:25 2018 +0000
+++ b/MMA8452Q.cpp	Sun Nov 18 19:24:26 2018 +0000
@@ -26,15 +26,18 @@
 {
     // Check to make sure the chip's ID matches the factory ID
     uint8_t c = readRegister(REG_WHO_AM_I);
+    printf("ID %c",c);
     if( c != FACTORY_ID ) {
         return false;
     }
-
     // Set default scale and data rate
     standby();
     setScale(DEFAULT_FSR);
+    printf("1");
     setODR(DEFAULT_ODR);
+    printf("2");
     setInterrupt();
+    printf("interrupt");
     active();
 
     return true;
@@ -186,7 +189,7 @@
     writeRegister( REG_CTRL_REG4, 0x20 ); // turn on transient flag
     writeRegister( REG_CTRL_REG5, 0x20 ); // route transient interrupt to pin1
     writeRegister( REG_TRANSIENT_CFG, 0x1E ); // detection turned on for x,y,z and reading source clears flag
-    //writeRegister( REG_TRANSIENT_THS,  ); //
+    writeRegister( REG_TRANSIENT_THS, 0x10 ); //
     //writeRegister( REG_TRANSIENT_COUNT,  ); //
 
 }