2 * Copyright (C) 2014 Intel Corporation.
5 #ifndef __CALIBRATION_H__
6 #define __CALIBRATION_H__
8 #define COMPASS_CALIBRATION_PATH "/data/compass.conf"
10 #define EPSILON 0.000000001
13 /* If no cal data is present - first calibration will
14 use a more relaxed set of values to get an initial
16 #define FIRST_MIN_DIFF 0.5f
17 #define FIRST_MAX_SQR_ERR 5.0f
18 #define FIRST_LOOKBACK_COUNT 4
21 #define MAX_SQR_ERR 3.5f
22 #define LOOKBACK_COUNT 6
26 #define RAW_DATA_FULL_PATH "/data/raw_compass_data_full_%d.txt"
27 #define RAW_DATA_SELECTED_PATH "/data/raw_compass_data_selected_%d.txt"
31 /* hard iron offsets */
34 /* soft iron matrix */
35 double w_invert[3][3];
37 /* geomagnetic strength */
42 typedef double mat_input_t[DS_SIZE][3];
44 void calibrate_compass (struct sensors_event_t* event, int64_t time);
45 void compass_read_data (const char* config_path);
46 void compass_store_data (const char* config_path);