AnnaLouise Martinez Midterm project
Dependencies: MMA8451Q8b SLCD mbed
Fork of KL46z_single_tap_2017_blank by
Revision 13:684b0c5c94fa, committed 2017-03-12
- Comitter:
- annalou
- Date:
- Sun Mar 12 23:59:05 2017 +0000
- Parent:
- 12:10e6d0d12833
- Commit message:
- Midterm Single tap filling parameters for z - axis
Changed in this revision
KL46z_single_tap_2017.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 10e6d0d12833 -r 684b0c5c94fa KL46z_single_tap_2017.cpp --- a/KL46z_single_tap_2017.cpp Thu Mar 09 02:37:39 2017 +0000 +++ b/KL46z_single_tap_2017.cpp Sun Mar 12 23:59:05 2017 +0000 @@ -2,6 +2,7 @@ #include "MMA8451Q8g.h" #include "SLCD.h" +#define PROGNAME "ParameterFill_AnnaLouise Martinez\n\r" #define BLINKTIME 1.5 #define RELAYON 0 #define RELAYOFF 1 @@ -29,14 +30,14 @@ You need to fill nn the missing numbers below for this to work 0x00 is just a place holder *************************************/ -#define LATCH_DATA 0x00 // for use in REG_PULSE_CFG -#define AXIS_DATA 0x00 -#define SET_INTERRUPT 0x00 //using interrupt INT1 PTC5 -#define SET_INT_LINE 0x00 +#define LATCH_DATA 0x21 // for use in REG_PULSE_CFG +#define AXIS_DATA 0x05 +#define SET_INTERRUPT 0x2F //using interrupt INT1 PTC5 +#define SET_INT_LINE 0x2F -#define SET_THZ 0x00 // See Table 49 in data sheet +#define SET_THZ 800 // See Table 49 in data sheet -#define SET_TMLT 0x00 // See Table 51 in data sheet +#define SET_TMLT 0X9F //0000_0159 // See Table 51 in data sheet /*********************************************************/ //#define PRINTDBUG @@ -65,6 +66,7 @@ int relayState = RELAYOFF; int outState = false; SLCD slcd; //define LCD display +Serial pc(USBTX, USBRX); char LCDMessages[2][LCDLEN] = {"TRUE", "FALS"}; @@ -97,6 +99,7 @@ int main() { + pc.printf(PROGNAME); uint8_t regData; @@ -125,14 +128,14 @@ LCDMess(lcdData,BLINKTIME); // Check to see if accerlometer is alive and well - acc.setGLimit(MAX_4G); // For now set to 2g + acc.setGLimit(MAX_2G); // For now set to 2g acc.readRegs(XYZ_DATA_CFG, ®Data, 1); sprintf (lcdData,"%x",regData); // Note displaying in hexidecimal LCDMess(lcdData,BLINKTIME); // Setup single-tap pulse prarameters. - acc.setRegisterInStandby(REG_PULSE_THSZ, SET_THZ); // write the data - acc.setRegisterInStandby(REH_PULSE_TMLT, SET_TMLT); // write the data + acc.setRegisterInStandby(REG_PULSE_THSZ,SET_THZ); // write the data + acc.setRegisterInStandby(REH_PULSE_TMLT,SET_TMLT); // write the data // Set up (pulse) interrupt to INT1 pin acc.setRegisterInStandby(REG_CTRL_4, SET_INTERRUPT); // write the data @@ -147,6 +150,7 @@ while (true) { acc.readRegs(REG_PULSE_SRC, ®Data, 1); sprintf (lcdData,"%x",regData); + pc.printf(lcdData,"%x",regData); LCDMess(lcdData,BLINKTIME); LCDMessNoDwell(LCDMessages[relayState]); wait(delay);