OSDN Git Service

Winter cleanup: rephrase traces and comments, rename vars, fix whitespaces
[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_t {
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     float average[3];
26 };
27
28 struct gyro_cal_t {
29     float bias_x, bias_y, bias_z;
30     int count;
31     float min_x, min_y, min_z;
32     float max_x, max_y, max_z;
33 };
34
35 typedef double mat_input_t[MAGN_DS_SIZE][3];
36
37 void calibrate_compass (struct sensors_event_t* event, struct sensor_info_t* info);
38 void compass_read_data (struct sensor_info_t* info);
39 void compass_store_data (struct sensor_info_t* info);
40
41 void calibrate_gyro(struct sensors_event_t* event, struct sensor_info_t* info);
42 void gyro_cal_init(struct sensor_info_t* info);
43 void gyro_store_data (struct sensor_info_t* info);
44 #endif