Mini Project 10: Displaying stuff from day 7

Dependencies:   DmTouch_UniGraphic UniGraphic mbed

Revision:
6:b196b0a8f337
Parent:
0:1ebe73e062a7
Child:
7:ee7f2c33d45d
--- a/acceler_sensor.cpp	Tue Jan 17 18:58:27 2017 +0000
+++ b/acceler_sensor.cpp	Tue Jan 17 19:12:33 2017 +0000
@@ -1,7 +1,7 @@
 #include "acceler_sensor.h"
 DigitalOut led3(LED3);
 
-void acceleration_n(void){
+void configure_acceleration(void){
     
     const int address = 0x53 << 1; // set 'address' to    
     i2c_port.start();
@@ -11,7 +11,6 @@
     i2c_port.stop();
     wait(0.01);
     
-     
     i2c_port.start();
     i2c_port.write(address);
     i2c_port.write(0x21);//set Tap Duration
@@ -61,5 +60,25 @@
     i2c_port.write(0x08);//measure mode 
     i2c_port.stop();
     wait(0.01);
-    
-}
\ No newline at end of file
+}
+
+void getacceleration (void){
+    char buffer[6];
+        int16_t rawdata[3];
+        /*acc.write(0x80|0x40|0x32);
+          for(int i=0; i<= 5; i++)
+            {
+                buffer[i]=12c.write(0x00);
+                //pc.printf("x = %+1.2fg\t", buffer[i]);
+            }
+        cs=1;
+        rawdata[0] = buffer[1]<<8 | buffer[0];
+        rawdata[1] = buffer[3]<<8 | buffer[2];
+        rawdata[2] = buffer[5]<<8 | buffer[4];
+        data[0] = rawdata[0]; 
+        data[1] = rawdata[1];
+        float x = data[0];
+        float y = data[1];
+        pc.printf("x = %+1.2fg\t y = %+1.2fg\n\r", rawdata[0],rawdata[1]); Just grabbed from SPI code. Not formatted right*/
+        
+    }
\ No newline at end of file