KBrat-SSD645-Midterm
Dependencies: MMA8451Q8g SLCD mbed
Fork of KL46z_single_tap_2017_blank by
Revision 13:d07864798cc9, committed 2017-03-13
- Comitter:
- tisbrat
- Date:
- Mon Mar 13 14:04:35 2017 +0000
- Parent:
- 12:10e6d0d12833
- Commit message:
- KBrat-SSD645-Midterm
Changed in this revision
KL46z_single_tap_2017.cpp | Show annotated file Show diff for this revision Revisions of this file |
MMA8451Q8g.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/KL46z_single_tap_2017.cpp Thu Mar 09 02:37:39 2017 +0000 +++ b/KL46z_single_tap_2017.cpp Mon Mar 13 14:04:35 2017 +0000 @@ -17,7 +17,7 @@ #define REG_OUT_Z_MSB 0x05 #define REG_PULSE_CFG 0x21 #define REG_PULSE_SRC 0x22 -#define REG_PULSE_THSZ 0x25 +#define REG_PULSE_THSZ 0x25 //Threshold on z axis #define REH_PULSE_TMLT 0x26 #define REG_CTRL_4 0x2D #define REG_CTRL_5 0x2E @@ -25,19 +25,15 @@ #define MAX_2G 0x00 #define MAX_4G 0x01 #define MAX_8G 0x02 -/************************************** -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 SET_THZ 0x00 // See Table 49 in data sheet +#define LATCH_DATA 0x40 // for use in REG_PULSE_CFG //0b01000000; //for pulse config register +#define AXIS_DATA 0x10 //0b00010000 +#define SET_INTERRUPT 0x08 //using interrupt INT1 PTC5 +#define SET_INT_LINE 0x08 -#define SET_TMLT 0x00 // See Table 51 in data sheet -/*********************************************************/ +#define SET_THZ 0x28 +#define SET_TMLT 0x0F + //#define PRINTDBUG // Accelerometer I2C pins @@ -54,8 +50,8 @@ #define MMA8451_I2C_ADDRESS (0x1d<<1) Ticker ledBlink; // timinginterrupt for RED led -InterruptIn MMA8451QInt1(PTC5); //push botton with internal pullup -//InterruptIn MMA8451QInt1(PTD1); +InterruptIn MMA8451QInt1(PTC5); //push button with internal pullup //INT1 +//InterruptIn MMA8451QInt1(PTD1);//push button with internal pullup //INT2 DigitalOut myled(LED_RED); // red led DigitalOut relay(LED_GREEN); // green led @@ -125,7 +121,8 @@ LCDMess(lcdData,BLINKTIME); // Check to see if accerlometer is alive and well - acc.setGLimit(MAX_4G); // For now set to 2g + //acc.setGLimit(MAX2_G); // For now set to 2g + acc.setGLimit(MAX_4G); // For now set to 4g acc.readRegs(XYZ_DATA_CFG, ®Data, 1); sprintf (lcdData,"%x",regData); // Note displaying in hexidecimal LCDMess(lcdData,BLINKTIME);
--- a/MMA8451Q8g.lib Thu Mar 09 02:37:39 2017 +0000 +++ b/MMA8451Q8g.lib Mon Mar 13 14:04:35 2017 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/scohennm/code/MMA8451Q8b/#12b18fdb72f7 +https://developer.mbed.org/users/tisbrat/code/MMA8451Q8g/#ce3dd4d8064a