Mini Project 10: Displaying stuff from day 7

Dependencies:   DmTouch_UniGraphic UniGraphic mbed

Revision:
0:1ebe73e062a7
Child:
6:b196b0a8f337
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/acceler_sensor.cpp	Tue Jan 17 18:14:15 2017 +0000
@@ -0,0 +1,65 @@
+#include "acceler_sensor.h"
+DigitalOut led3(LED3);
+
+void acceleration_n(void){
+    
+    const int address = 0x53 << 1; // set 'address' to    
+    i2c_port.start();
+    i2c_port.write(address);
+    i2c_port.write(0x1D);   //to set the Tap Threshold
+    i2c_port.write(0x50 << 2); 
+    i2c_port.stop();
+    wait(0.01);
+    
+     
+    i2c_port.start();
+    i2c_port.write(address);
+    i2c_port.write(0x21);//set Tap Duration
+    i2c_port.write(0x0A); 
+    i2c_port.stop();
+    wait(0.01);
+     
+    i2c_port.start();
+    i2c_port.write(address);
+    int temp[2] = {0x22, 0x05};
+    i2c_port.write(temp[0]);//set Tap Gap
+    i2c_port.write(temp[1]);
+    i2c_port.stop();
+    wait(0.01);
+    
+    i2c_port.start();
+    i2c_port.write(address);
+    i2c_port.write(0x23);//set Tap Window
+    i2c_port.write(0xFF);
+    i2c_port.stop();
+    wait(0.01);
+ 
+    i2c_port.start();
+    i2c_port.write(address);
+    i2c_port.write(0x2A);//set Tap Axis
+    i2c_port.write(0x07);
+    i2c_port.stop();
+    wait(0.01);
+
+    i2c_port.start();
+    i2c_port.write(address);
+    i2c_port.write(0x2E);//set interupt Enable
+    i2c_port.write(0x20|0x40);
+    i2c_port.stop();
+    wait(0.01);
+  
+    i2c_port.start();
+    i2c_port.write(address);
+    i2c_port.write(0x2F);//set interupt map
+    i2c_port.write(0x20|0x40); 
+    i2c_port.stop();
+    wait(0.01);
+
+    i2c_port.start();
+    i2c_port.write(address);
+    i2c_port.write(0x2D);//power control register
+    i2c_port.write(0x08);//measure mode 
+    i2c_port.stop();
+    wait(0.01);
+    
+}
\ No newline at end of file