![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Pulse Detection in z-axis
Dependencies: MMA8451Q8b SLCD mbed
Fork of KL46z_single_tap_generic by
Diff: main.cpp
- Revision:
- 9:08acb96591a8
- Parent:
- 8:ef41bb84f1cc
- Child:
- 10:92c7ff5198ee
--- a/main.cpp Mon Feb 16 19:49:09 2015 +0000 +++ b/main.cpp Mon Feb 16 20:06:22 2015 +0000 @@ -86,8 +86,7 @@ uint8_t regData = MAX_4G; uint8_t latchData = 0x40; //0b01000000; //for pulse config register uint8_t axisData = 0x10; //0b00010000; - uint8_t interrupt1EnableData = 0x08; //0b00001000; - uint8_t interrupt1SetData = 0x04; //0b00000100; + char lcdData[LCDLEN]; myled.write(outState); @@ -95,7 +94,7 @@ // set up interrrupts to be used later for taps MMA8451QInt1.rise(&GreenLEDBlinker); - MMA8451QInt1.mode(PullNone); + MMA8451QInt1.mode(PullNone); // set up interrrupts to be used later for taps // mybutton.fall(&pressed); @@ -106,17 +105,16 @@ acc.readRegs(XYZ_DATA_CFG, ®Data, 1); sprintf (lcdData,"%x",regData); // Note displaying in hexidecimal LCDMess(lcdData,BLINKTIME); + +// Set up (pulse) interrupt to INT1 pin + acc.setRegisterInStandby(REG_CTRL_4, SET_INTERRUPT); // write the data + acc.setRegisterInStandby(REG_CTRL_5, SET_INT_LINE); // write the data + acc.readRegs(REG_WHO_AM_I, ®Data, 1); sprintf (lcdData,"%x",regData); LCDMess(lcdData,BLINKTIME); -// Set up (pulse) interrupt to INT1 pin - regData = interrupt1EnableData; - acc.setRegisterInStandby(REG_CTRL_4, regData); // write the data - regData = interrupt1SetData; - acc.setRegisterInStandby(REG_CTRL_5, regData); // write the data - while (true) { // Read Pulse Source Data and check to see if things have been set