Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:c2d23138786f, committed 2013-03-10
- Comitter:
- JoKer
- Date:
- Sun Mar 10 04:41:35 2013 +0000
- Commit message:
- MMA8451Q Double Tap and Interrupt example for FRDM KL25Z board
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Sun Mar 10 04:41:35 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/JoKer/code/MMA8451Q/#2d14600116fc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Mar 10 04:41:35 2013 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+#define ON 0
+#define OFF !ON
+
+//Setup the interrupts for the MMA8451Q
+InterruptIn accInt1(PTA14);
+InterruptIn accInt2(PTA15);//not used in this prog but this is the other int from the accelorometer
+
+uint8_t togstat=0;//Led status
+DigitalOut bled(LED_BLUE);
+
+
+void tapTrue(void){
+ if(togstat == 0){
+ togstat = 1;
+ bled=ON;
+ } else {
+ togstat = 0;
+ bled=OFF;
+ }
+
+}
+
+
+int main(void) {
+
+ MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);//accelorometer instance
+
+ acc.setDoubleTap();//Setup the MMA8451Q to look for a double Tap
+ accInt1.rise(&tapTrue);//call tapTrue when an interrupt is generated on PTA14
+
+ while (true) {
+ //Interrupt driven so nothing in main loop
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Mar 10 04:41:35 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b \ No newline at end of file