Implemented first Hangar-Service

Dependencies:   CalibrateMagneto QuaternionMath

Fork of SML2 by TobyRich GmbH

Revision:
8:cba37530d480
Parent:
7:604a8369b801
Child:
9:a0ae9e68f95d
--- a/Accelerometer.cpp	Tue Feb 17 16:53:50 2015 +0000
+++ b/Accelerometer.cpp	Wed Feb 18 15:13:41 2015 +0000
@@ -2,6 +2,8 @@
 #define DEBUG "BMX055-Acc"
 #include "Logger.h"
 
+#include "Vector3.h"
+
 Accelerometer::Accelerometer(I2C &i2c) : I2CPeripheral(i2c, 0x18 << 1 /* address */)
 {
     if (powerOn()) {
@@ -29,22 +31,16 @@
 
 void Accelerometer::start()
 {
-    // nothing to do right now except reset the timestamp counter
-    timer.stop();
-    timer.reset();
-    timer.start();
+    // nothing to do right now
 }
 
 void Accelerometer::stop()
 {
     // nothing to do right now
-    timer.stop();
 }
 
-Sensor::Data Accelerometer::read()
+Vector3 Accelerometer::read()
 {
-    Sensor::Data frame;
-    
     // Check comments in the read() function of the Gyroscope for more info why we read bytes one by one.
     union {
         uint8_t bytes[6];
@@ -62,9 +58,7 @@
     f.bytes[4] = read_reg(0x06) >> 4;
     f.bytes[5] = read_reg(0x07);
     
-    frame.x = f.values.x;
-    frame.y = f.values.y;
-    frame.z = f.values.z;
-
-    return frame;
+    const float accel_resolution = 0.0009765625;
+    
+    return Vector3(f.values.x, f.values.y, f.values.z) * accel_resolution;
 }