Sara Wescott / Mbed 2 deprecated Mini_project_10

Dependencies:   DmTouch_UniGraphic UniGraphic mbed

Files at this revision

API Documentation at this revision

Comitter:
ezimmerman17
Date:
Tue Jan 17 19:12:33 2017 +0000
Parent:
5:eaf6008bf60b
Child:
7:ee7f2c33d45d
Commit message:
messed with accelerometer file stuff;

Changed in this revision

acceler_sensor.cpp Show annotated file Show diff for this revision Revisions of this file
acceler_sensor.h Show annotated file Show diff for this revision Revisions of this file
--- 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
--- a/acceler_sensor.h	Tue Jan 17 18:58:27 2017 +0000
+++ b/acceler_sensor.h	Tue Jan 17 19:12:33 2017 +0000
@@ -5,5 +5,5 @@
 
 extern Serial pc;
 extern I2C i2c_port;
-void acceleration_n(void);
+void configure_acceleration(void);
 #endif
\ No newline at end of file