OSDN Git Service

Reinstate monotonic timestamp in data acquisition threads
[android-x86/hardware-intel-libsensors.git] / calibration.h
1 /*
2  * Copyright (C) 2014 Intel Corporation.
3  */
4
5 #ifndef __CALIBRATION_H__
6 #define __CALIBRATION_H__
7
8 #include "common.h"
9
10 #define MAGN_DS_SIZE 32
11
12 struct compass_cal {
13     /* hard iron offsets */
14     double offset[3][1];
15
16     /* soft iron matrix */
17     double w_invert[3][3];
18
19     /* geomagnetic strength */
20     double bfield;
21
22     /* selection data */
23     float sample[MAGN_DS_SIZE][3];
24     unsigned int sample_count;
25 };
26
27 struct gyro_cal {
28     float bias_x, bias_y, bias_z;
29     int count;
30     float min_x, min_y, min_z;
31     float max_x, max_y, max_z;
32 };
33
34 typedef double mat_input_t[MAGN_DS_SIZE][3];
35
36 void calibrate_compass (struct sensors_event_t* event, struct sensor_info_t* info);
37 void compass_read_data (struct sensor_info_t* info);
38 void compass_store_data (struct sensor_info_t* info);
39
40 void calibrate_gyro(struct sensors_event_t* event, struct sensor_info_t* info);
41 void gyro_cal_init(struct sensor_info_t* info);
42 void gyro_store_data (struct sensor_info_t* info);
43 #endif