Implemented first Hangar-Service

Dependencies:   CalibrateMagneto QuaternionMath

Fork of SML2 by TobyRich GmbH

Revision:
41:731e3cfac19b
Parent:
35:fb6e4601adf3
Child:
42:160a37bdaa64
--- a/SensorFusion.h	Tue May 19 14:18:30 2015 +0000
+++ b/SensorFusion.h	Wed May 20 10:13:14 2015 +0000
@@ -17,15 +17,19 @@
     };
     
     SensorFusion(I2C &i2c);
-    void setDelegate(Delegate &d);
-
-    bool start();
-    void stop();
+    SensorFusion(const SensorFusion& s);
+    virtual ~SensorFusion();
+    
+    void setDelegate(Delegate &d); 
+    void getMagnetometerCalibration(Vector3 &min, Vector3 &max);
+  
+    
+    virtual bool start();
+    virtual void stop();
+    virtual void sensorUpdate(Vector3 gyro_degrees);                 // gyro's callback
+    
 
-    virtual void sensorUpdate(Vector3 gyro_degrees); // gyro's callback
-    void getMagnetometerCalibration(Vector3 &min, Vector3 &max);
-
-private:
+protected:
     Delegate defaultDelegate; // to avoid check for existence every time
     Delegate* delegate;
     Accelerometer accel;
@@ -34,8 +38,45 @@
     Quaternion q;
     float const deltat, beta;
     Vector3 fused;
-    void updateFilter(float ax, float ay, float az, float gx, float gy, float gz);
+    
+    void startAccelerometer();
+    void startGyrometer();
+    bool startMagnetometer();
+    
+    void stopAccelerometer();
+    void stopGyrometer();
+    void stopMagnetometer();
+};
+
+class NineAxesSensor : public SensorFusion
+{
+public:
+    NineAxesSensor(I2C &i2c);
+    NineAxesSensor(const NineAxesSensor& c);
+    virtual ~NineAxesSensor();
+
+    virtual bool start();
+    virtual void stop();
+    virtual void sensorUpdate(Vector3 gyro_degrees);
+
+private:
     void updateFilter(float ax, float ay, float az, float gx, float gy, float gz, float mx, float my, float mz);
 };
 
+class SixAxesSensor : public SensorFusion
+{
+public:
+    SixAxesSensor(I2C &i2c);
+    SixAxesSensor(const SixAxesSensor& c);
+    virtual ~SixAxesSensor();
+    
+    virtual bool start();
+    virtual void stop();
+    virtual void sensorUpdate(Vector3 gyro_degrees);
+
+private:
+    void updateFilter(float ax, float ay, float az, float gx, float gy, float gz);
+};
+
+
 #endif
\ No newline at end of file