The whole program
Dependencies: MMA8451Q8 SLCD mbed
Fork of KL46z_single_tap_empty by
Revision 4:d75c7e69796b, committed 2015-02-09
- Comitter:
- bomalley
- Date:
- Mon Feb 09 18:19:28 2015 +0000
- Parent:
- 3:53d47a5dbb2c
- Commit message:
- pgm
Changed in this revision
--- a/MMA8451Q8.lib Tue Feb 03 18:05:52 2015 +0000 +++ b/MMA8451Q8.lib Mon Feb 09 18:19:28 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/scohennm/code/MMA8451Q8b/#993bb9e96a4b +http://developer.mbed.org/users/bomalley/code/MMA8451Q8/#84011f06d1ea
--- a/main.cpp Tue Feb 03 18:05:52 2015 +0000 +++ b/main.cpp Mon Feb 09 18:19:28 2015 +0000 @@ -18,6 +18,14 @@ #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 MAX_2G 0x00 #define MAX_4G 0x01 #define MAX_8G 0x02 @@ -41,13 +49,15 @@ DigitalOut myled(LED_RED); // red led DigitalOut relay(LED_GREEN); // green led - MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS); +MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS); float delay = WAITDELAY; int relayState = RELAYOFF; 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){ @@ -111,6 +121,10 @@ sprintf (lcdData,"%x",regData); LCDMess(lcdData,BLINKTIME); + //send address + regData = latchData | axisData; + regAddress = 0; + acc.setRegisterInStandby(registerArray[regAddress], regData); acc.readRegs(REG_PULSE_SRC, ®Data, 1); sprintf (lcdData,"%x",regData); LCDMess(lcdData,BLINKTIME);
--- a/mbed.bld Tue Feb 03 18:05:52 2015 +0000 +++ b/mbed.bld Mon Feb 09 18:19:28 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file