OSDN Git Service

Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into l...
[android-x86/hardware-intel-libsensors.git] / calibration.h
index d6c8616..00324da 100644 (file)
@@ -36,16 +36,45 @@ typedef struct {
 }
 gyro_cal_t;
 
+/* Accelerometer bias estimation and compensation */
+
+#define BUCKET_COUNT 3
+#define BUCKET_TOLERANCE 1     /* Maximum monitoring distance from value of interest, in m/s² */
+#define SLICES 100                 /* We currently have 3 buckets per axis, and 100 slices per bucket ; then we distribute incoming samples among slices */
+
+typedef struct
+{
+    int version;
+    int bucket_count;
+    int slices;
+    float bucket_tolerance;
+
+    uint64_t bucket[3][BUCKET_COUNT][SLICES];  /* How many samples fell in each of the slices, per axis */
+    uint64_t bucket_usage[3][BUCKET_COUNT];    /* How many samples fell in each of the buckets (= sum of the slice counts) */
+
+    /* Estimated bias, according to accumulated data */
+    float accel_bias_x;
+    float accel_bias_y;
+    float accel_bias_z;
+
+    uint64_t last_estimation_ts;
+}
+accel_cal_t;
+
 
 typedef double mat_input_t[MAGN_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  (int s, sensors_event_t* event);
+void compass_read_data  (int s);
+void compass_store_data (int s);
+
+void calibrate_gyro     (int s, sensors_event_t* event);
+void gyro_cal_init      (int s);
+void gyro_store_data    (int s);
 
-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);
+void calibrate_accel    (int s, sensors_event_t* event);
+void accel_cal_init     (int s);
+void accel_cal_store   (int s);
 
 #endif