![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
SB-Midterm-part2
Dependencies: MMA8451Q8b SLCD mbed
Fork of KL46z_single_tap_2017 by
Revision 14:a7cf32971254, committed 2017-03-15
- Comitter:
- sbart
- Date:
- Wed Mar 15 05:39:48 2017 +0000
- Parent:
- 13:71be063390b1
- Commit message:
- -
Changed in this revision
KL46z_double_tap_2017..cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/KL46z_double_tap_2017..cpp Wed Mar 15 05:27:46 2017 +0000 +++ b/KL46z_double_tap_2017..cpp Wed Mar 15 05:39:48 2017 +0000 @@ -32,7 +32,7 @@ #define MAX_8G 0x02 #define SET_INTERRUPT 0x08 //SB - enable pulse interrupt #define SET_INT_LINE 0x00 //SB - set to INT2 -#define SET_THZ 0x28 // See Table 49 in data sheet +#define SET_THZ 0x28 //SB - 2.5g/0.063g/count = 40 counts #define SET_LTCY 0x1C //SB - Set pulse latency to 35 ms (28 * 1.25ms) @@ -65,8 +65,10 @@ #define MMA8451_I2C_ADDRESS (0x1d<<1) Ticker ledBlink; // timinginterrupt for RED led + //SB - change interrupt pin address InterruptIn MMA8451QInt1(PTD1); //push botton with internal pullup + DigitalOut myled(LED_RED); // red led DigitalOut relay(LED_GREEN); // green led @@ -156,6 +158,7 @@ pc.printf("%2X", REG_1_OR_MASK); pc.printf("\n"); + //SB - Set up the ODR to 400Hz using masks to clear and preserve the bits acc.readRegs(REG_CTRL_1, ®Data, 1); regData = regData & REG_1_AND_MASK; //SB - clear needed bits while preserving others