OSDN Git Service

[Activity HAL] Separation of common macros
[android-x86/hardware-intel-libsensors.git] / calibration.h
index 3da2156..d6c8616 100644 (file)
@@ -1,31 +1,14 @@
 /*
- * Copyright (C) 2014 Intel Corporation.
+ * Copyright (C) 2014-2015 Intel Corporation.
  */
 
 #ifndef __CALIBRATION_H__
 #define __CALIBRATION_H__
 
-#define COMPASS_CALIBRATION_PATH "/data/compass.conf"
-#define DS_SIZE 48
-#define EPSILON 0.000000001
+#include "common.h"
 
+#define MAGN_DS_SIZE 32
 
-/* If no cal data is present - first calibration will
-   use a more relaxed set of values to get an initial
-   calibration faster */
-#define FIRST_MIN_DIFF 1.0f
-#define FIRST_MAX_SQR_ERR 3.5f
-#define FIRST_LOOKBACK_COUNT 4
-
-#define MIN_DIFF 1.5f
-#define MAX_SQR_ERR 2.5f
-#define LOOKBACK_COUNT 6
-
-
-#ifdef DBG_RAW_DATA
-#define RAW_DATA_FULL_PATH "/data/raw_compass_data_full_%d.txt"
-#define RAW_DATA_SELECTED_PATH "/data/raw_compass_data_selected_%d.txt"
-#endif
 
 typedef struct {
     /* hard iron offsets */
@@ -37,12 +20,32 @@ typedef struct {
     /* geomagnetic strength */
     double bfield;
 
-} calibration_data;
+    /* selection data */
+    float sample[MAGN_DS_SIZE][3];
+    unsigned int sample_count;
+    float average[3];
+}
+compass_cal_t;
+
+
+typedef struct {
+    float bias_x, bias_y, bias_z;
+    int count;
+    float min_x, min_y, min_z;
+    float max_x, max_y, max_z;
+}
+gyro_cal_t;
+
+
+typedef double mat_input_t[MAGN_DS_SIZE][3];
+
 
-typedef double mat_input_t[DS_SIZE][3];
+void calibrate_compass  (sensors_event_t* event, sensor_info_t* info);
+void compass_read_data  (sensor_info_t* info);
+void compass_store_data (sensor_info_t* info);
 
-void calibrate_compass (struct sensors_event_t* event, int64_t time);
-void compass_read_data (const char* config_path);
-void compass_store_data (const char* config_path);
+void calibrate_gyro     (sensors_event_t* event, sensor_info_t* info);
+void gyro_cal_init      (sensor_info_t* info);
+void gyro_store_data    (sensor_info_t* info);
 
 #endif