Home | History | Annotate | Download | only in mllite
      1 /*
      2  $License:
      3    Copyright 2011 InvenSense, Inc.
      4 
      5  Licensed under the Apache License, Version 2.0 (the "License");
      6  you may not use this file except in compliance with the License.
      7  You may obtain a copy of the License at
      8 
      9  http://www.apache.org/licenses/LICENSE-2.0
     10 
     11  Unless required by applicable law or agreed to in writing, software
     12  distributed under the License is distributed on an "AS IS" BASIS,
     13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  See the License for the specific language governing permissions and
     15  limitations under the License.
     16   $
     17  */
     18 
     19 /******************************************************************************
     20  *
     21  * $Id: mlsupervisor.h 5629 2011-06-11 03:13:08Z mcaramello $
     22  *
     23  *****************************************************************************/
     24 
     25 #ifndef __INV_SUPERVISOR_H__
     26 #define __INV_SUPERVISOR_H__
     27 
     28 #include "mltypes.h"
     29 #ifdef INV_INCLUDE_LEGACY_HEADERS
     30 #include "mlsupervisor_legacy.h"
     31 #endif
     32 
     33 // The value of inv_get_gyro_sum_of_sqr is scaled such the (1 dps)^2 = 2^this_number
     34 // this number must be >=0 and even.
     35 #define GYRO_MAG_SQR_SHIFT 6
     36 // The value of inv_accel_sum_of_sqr is scaled such that (1g)^2 = 2^this_number
     37 #define ACC_MAG_SQR_SHIFT 16
     38 
     39 #define CAL_RUN             0
     40 #define CAL_RESET           1
     41 #define CAL_CHANGED_DATA    2
     42 #define CAL_RESET_TIME      3
     43 #define CAL_ADD_DATA        4
     44 #define CAL_COMBINE         5
     45 
     46 #define P_INIT  100000
     47 
     48 #define SF_NORMAL           0
     49 #define SF_DISTURBANCE      1
     50 #define SF_FAST_SETTLE      2
     51 #define SF_SLOW_SETTLE      3
     52 #define SF_STARTUP_SETTLE   4
     53 #define SF_UNCALIBRATED     5
     54 
     55 struct inv_supervisor_cb_obj {
     56     void (*accel_compass_fusion_func) (double magFB);
     57      inv_error_t(*progressive_no_motion_supervisor_func) (unsigned long
     58                                                           deltaTime);
     59      inv_error_t(*sensor_fusion_advanced_func) (double *magFB,
     60                                                 unsigned long deltaTime);
     61     void (*reset_advanced_compass_func) (void);
     62     void (*supervisor_reset_func) (void);
     63 };
     64 
     65 inv_error_t inv_reset_compass_calibration(void);
     66 void inv_init_sensor_fusion_supervisor(void);
     67 inv_error_t inv_accel_compass_supervisor(void);
     68 inv_error_t inv_pressure_supervisor(void);
     69 
     70 #endif // __INV_SUPERVISOR_H__
     71 
     72