Fixed algorithm to read 3 bytes of accelerometer data registers

Fork of COG4050_adxl355_adxl357 by valeria toffoli

Revision:
9:6c803986dbde
Parent:
8:9e6ead2ee8d7
--- a/Calibration/CALIBRATION.h	Tue Aug 21 13:25:37 2018 +0000
+++ b/Calibration/CALIBRATION.h	Mon Sep 03 10:39:56 2018 +0000
@@ -9,34 +9,33 @@
     // CONST AND VARIABLES        // 
     // -------------------------- //
     typedef struct {
-        // sensitivity
-        float S[2][2];
-        float St;
+        // sensitivity - we do not consider cross sensitivity
+        float S[3]; 
+        // temperature sensitivity 
+        float St[3];
         // 0g offset
-        float B[2][0];
+        float B[3];
     } calib_data_t;
-    typedef struct {
-        float x_matrix[12][4];
-        float x_transpose[4][12];
-        float xtx_product[12][12];
-    } matrix_data_t;
-    float g_matrix[3][12]; 
-    matrix_data_t coeff_matrix;  
-    float w_matrix[4][3];     
+    calib_data_t  adxl355_sensitivity;
+    calib_data_t  adxl357_sensitivity;
     // -------------------------- //
     // FUNCTIONS                  //  
     // -------------------------- //
     
-    calib_data_t convert_2p(float angle[11][2], float meas[11][2]);
-    calib_data_t convert_6p(float angle[11][2], float meas[11][2]);
-    calib_data_t convert_12p(float angle[11][2], float meas[11][2]);
+    calib_data_t convert_2p_all(float angle[1], float meas[1][2]);
+            // angle = | angle1 angle2| in RAD
+            // meas =  | ax1    ay1     az1 |
+            //         | ax2    ay2     az2 |
+    void convert_2p(float meas[1], int axis);
+            // angle = | angle1 angle2| in RAD
+            // meas =  | x1     x2 |
+    void convert_4p(float meas[3], int axis);
+            // for each axis
+            // angle = | anglex1 anglex2 angley3 angley4|
+            // meas =  | x1     x2      x3      x4 |
     
-    float matrix_determinant(float a[12][12], float k);
-    float matrix_cofactor(float a[12][2], float k);
-    
+    float matrix_determinant(float a[12][12], float k);    
     void matrix_reset();
-    void matrix_g(float angle[4][12]);    // angle expressed in degree!
-    void matrix_x(float meas[3][12]);
 private:
 };