The whole program
Dependencies: MMA8451Q8_v1 SLCD mbed
Fork of KL46z_single_tap_HW4_2_1 by
Revision 5:0930b17d337d, committed 2015-02-16
- Comitter:
- bomalley
- Date:
- Mon Feb 16 03:23:33 2015 +0000
- Parent:
- 4:d75c7e69796b
- Commit message:
- Project v1
Changed in this revision
MMA8451Q8.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d75c7e69796b -r 0930b17d337d MMA8451Q8.lib --- a/MMA8451Q8.lib Mon Feb 09 18:19:28 2015 +0000 +++ b/MMA8451Q8.lib Mon Feb 16 03:23:33 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/bomalley/code/MMA8451Q8/#84011f06d1ea +http://developer.mbed.org/users/bomalley/code/MMA8451Q8_v1/#a3c651c98243
diff -r d75c7e69796b -r 0930b17d337d main.cpp --- a/main.cpp Mon Feb 09 18:19:28 2015 +0000 +++ b/main.cpp Mon Feb 16 03:23:33 2015 +0000 @@ -18,13 +18,16 @@ #define REG_PULSE_SRC 0x22 #define REG_PULSE_CFG 0x21 -#define REG_PULSE_THSX 0x23 -#define REG_PULSE_THSY 0x24 #define REG_PULSE_THSZ 0x25 #define REG_PULSE_TMLT 0x26 #define REG_PULSE_LTCY 0x27 -#define REG_PULSE_WIND 0x28 + +#define REG_CTRL_REG4 0x2D +#define REG_CTRL_REG5 0x2E +#define REG_DATA_THSZ 0x08 +#define REG_DATA_TMLT 0x26 +#define REG_DATA_LTCY 0x27 #define MAX_2G 0x00 #define MAX_4G 0x01 @@ -56,8 +59,6 @@ int outState = false; SLCD slcd; //define LCD display char LCDMessages[2][LCDLEN] = {"TRUE", "FALS"}; -uint8_t registerArray[8] = {REG_PULSE_CFG, REG_PULSE_SRC, REG_PULSE_THSX, REG_PULSE_THSY, REG_PULSE_THSZ, REG_PULSE_TMLT, REG_PULSE_LTCY, REG_PULSE_WIND}; -uint8_t regAddress; void LCDMess(char *lMess, float dWait){ @@ -96,7 +97,8 @@ relay.write(relayState); // set up interrrupts to be used later for taps - mybutton.fall(&pressed); + mybutton.rise(&pressed); + mybutton.mode(PullNone); // set up interrrupts to be used later for taps ledBlink.attach(&LEDBlinker, LEDDELAY); @@ -122,9 +124,13 @@ LCDMess(lcdData,BLINKTIME); //send address - regData = latchData | axisData; - regAddress = 0; - acc.setRegisterInStandby(registerArray[regAddress], regData); + acc.setRegisterInStandby(REG_PULSE_THSZ, REG_DATA_THSZ); + acc.setRegisterInStandby(REG_PULSE_TMLT, REG_DATA_TMLT); + acc.setRegisterInStandby(REG_PULSE_LTCY, REG_DATA_LTCY); + + acc.setRegisterInStandby(REG_CTRL_REG4, 0x08); + acc.setRegisterInStandby(REG_CTRL_REG5, 0x08); + acc.readRegs(REG_PULSE_SRC, ®Data, 1); sprintf (lcdData,"%x",regData); LCDMess(lcdData,BLINKTIME);