Icm20948Dmp3Driver.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * ________________________________________________________________________________________________________
  3. * Copyright © 2014 InvenSense Inc. All rights reserved.
  4. *
  5. * This software and/or documentation (collectively “Software”) is subject to InvenSense intellectual property rights
  6. * under U.S. and international copyright and other intellectual property rights laws.
  7. *
  8. * The Software contained herein is PROPRIETARY and CONFIDENTIAL to InvenSense and is provided
  9. * solely under the terms and conditions of a form of InvenSense software license agreement between
  10. * InvenSense and you and any use, modification, reproduction or disclosure of the Software without
  11. * such agreement or the express written consent of InvenSense is strictly prohibited.
  12. *
  13. * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, THE SOFTWARE IS
  14. * PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  15. * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  16. * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, IN NO EVENT SHALL
  17. * INVENSENSE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
  18. * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  19. * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  20. * OF THE SOFTWARE.
  21. * ________________________________________________________________________________________________________
  22. */
  23. #ifndef _DMP_3_ICM20948_XFSD_H__
  24. #define _DMP_3_ICM20948_XFSD_H__
  25. #include <stdint.h>
  26. #ifdef __cplusplus
  27. extern "C"
  28. {
  29. #endif
  30. /* dmp3a.20648-0.4.1 */
  31. /* forward declaration */
  32. struct inv_icm20948;
  33. /* enum for sensor
  34. The sequence is important.
  35. It represents the order of apperance from DMP */
  36. enum INV_SENSORS {
  37. INV_SENSOR_ACCEL = 0,
  38. INV_SENSOR_GYRO,
  39. INV_SENSOR_LPQ, // 20610: we'll find out if it breaks 20628 being inserted here....
  40. INV_SENSOR_COMPASS,
  41. INV_SENSOR_ALS,
  42. INV_SENSOR_SIXQ,
  43. INV_SENSOR_NINEQ,
  44. INV_SENSOR_GEOMAG,
  45. INV_SENSOR_PEDQ,
  46. INV_SENSOR_PRESSURE,
  47. INV_SENSOR_CALIB_GYRO,
  48. INV_SENSOR_CALIB_COMPASS,
  49. INV_SENSOR_STEP_COUNTER,
  50. INV_SENSOR_ACTIVITY_CLASSIFIER,
  51. INV_SENSOR_FLIP_PICKUP,
  52. INV_SENSOR_BRING_TO_SEE,
  53. INV_SENSOR_SIXQ_accel,
  54. INV_SENSOR_NINEQ_accel,
  55. INV_SENSOR_GEOMAG_cpass,
  56. INV_SENSOR_NINEQ_cpass,
  57. INV_SENSOR_WAKEUP_ACCEL,
  58. INV_SENSOR_WAKEUP_GYRO,
  59. //INV_SENSOR_WAKEUP_LPQ,
  60. INV_SENSOR_WAKEUP_COMPASS,
  61. INV_SENSOR_WAKEUP_ALS,
  62. INV_SENSOR_WAKEUP_SIXQ,
  63. INV_SENSOR_WAKEUP_NINEQ,
  64. INV_SENSOR_WAKEUP_GEOMAG,
  65. INV_SENSOR_WAKEUP_PEDQ,
  66. INV_SENSOR_WAKEUP_PRESSURE,
  67. INV_SENSOR_WAKEUP_CALIB_GYRO,
  68. INV_SENSOR_WAKEUP_CALIB_COMPASS,
  69. INV_SENSOR_WAKEUP_STEP_COUNTER,
  70. INV_SENSOR_WAKEUP_TILT_DETECTOR,
  71. //INV_SENSOR_WAKEUP_ACTIVITY_CLASSIFIER,
  72. INV_SENSOR_WAKEUP_SIXQ_accel,
  73. INV_SENSOR_WAKEUP_NINEQ_accel,
  74. INV_SENSOR_WAKEUP_GEOMAG_cpass,
  75. INV_SENSOR_WAKEUP_NINEQ_cpass,
  76. INV_SENSOR_NUM_MAX,
  77. INV_SENSOR_INVALID,
  78. };
  79. enum accel_cal_params {
  80. ACCEL_CAL_ALPHA_VAR = 0,
  81. ACCEL_CAL_A_VAR,
  82. ACCEL_CAL_DIV,
  83. NUM_ACCEL_CAL_PARAMS
  84. };
  85. enum compass_cal_params {
  86. CPASS_CAL_TIME_BUFFER = 0,
  87. CPASS_CAL_RADIUS_3D_THRESH_ANOMALY,
  88. NUM_CPASS_CAL_PARAMS
  89. };
  90. int inv_icm20948_load_firmware(struct inv_icm20948 * s, const unsigned char *dmp3_image, unsigned int dmp3_image_size);
  91. void inv_icm20948_get_dmp_start_address(struct inv_icm20948 * s, unsigned short *dmp_cnfg);
  92. int dmp_icm20948_reset_control_registers(struct inv_icm20948 * s);
  93. int dmp_icm20948_set_data_output_control1(struct inv_icm20948 * s, int output_mask);
  94. int dmp_icm20948_set_data_output_control2(struct inv_icm20948 * s, int output_mask);
  95. int dmp_icm20948_set_data_interrupt_control(struct inv_icm20948 * s, uint32_t interrupt_ctl);
  96. int dmp_icm20948_set_FIFO_watermark(struct inv_icm20948 * s, unsigned short fifo_wm);
  97. int dmp_icm20948_set_data_rdy_status(struct inv_icm20948 * s, unsigned short data_rdy);
  98. int dmp_icm20948_set_motion_event_control(struct inv_icm20948 * s, unsigned short motion_mask);
  99. int dmp_icm20948_set_sensor_rate(struct inv_icm20948 * s, int sensor, short divider);
  100. int dmp_icm20948_set_batchmode_params(struct inv_icm20948 * s, unsigned int thld, short mask);
  101. int dmp_icm20948_set_bias_acc(struct inv_icm20948 * s, int *bias);
  102. int dmp_icm20948_set_bias_gyr(struct inv_icm20948 * s, int *bias);
  103. int dmp_icm20948_set_bias_cmp(struct inv_icm20948 * s, int *bias);
  104. int dmp_icm20948_get_bias_acc(struct inv_icm20948 * s, int *bias);
  105. int dmp_icm20948_get_bias_gyr(struct inv_icm20948 * s, int *bias);
  106. int dmp_icm20948_get_bias_cmp(struct inv_icm20948 * s, int *bias);
  107. int dmp_icm20948_set_gyro_sf(struct inv_icm20948 * s, long gyro_sf);
  108. int dmp_icm20948_set_accel_feedback_gain(struct inv_icm20948 * s, int accel_gain);
  109. int dmp_icm20948_set_accel_cal_params(struct inv_icm20948 * s, int *accel_cal);
  110. int dmp_icm20948_set_compass_cal_params(struct inv_icm20948 * s, int *compass_cal);
  111. int dmp_icm20948_set_compass_matrix(struct inv_icm20948 * s, int *compass_mtx);
  112. int dmp_icm20948_get_pedometer_num_of_steps(struct inv_icm20948 * s, unsigned long *steps);
  113. int dmp_icm20948_set_pedometer_rate(struct inv_icm20948 * s, int ped_rate);
  114. int dmp_icm20948_set_wom_enable(struct inv_icm20948 * s, unsigned char enable);
  115. int dmp_icm20948_set_wom_motion_threshold(struct inv_icm20948 * s, int threshold);
  116. int dmp_icm20948_set_wom_time_threshold(struct inv_icm20948 * s, unsigned short threshold);
  117. int dmp_icm20948_set_gyro_fsr(struct inv_icm20948 * s, short gyro_fsr);
  118. int dmp_icm20948_set_accel_fsr(struct inv_icm20948 * s, short accel_fsr);
  119. int dmp_icm20948_set_accel_scale2(struct inv_icm20948 * s, short accel_fsr);
  120. int dmp_icm20948_set_eis_auth_input(struct inv_icm20948 * s, long eis_auth_input);
  121. int dmp_icm20948_get_eis_auth_output(struct inv_icm20948 * s, long *eis_auth_output);
  122. int dmp_icm20948_set_bac_rate(struct inv_icm20948 * s, short bac_odr);
  123. int dmp_icm20948_set_b2s_rate(struct inv_icm20948 * s, short accel_odr);
  124. int dmp_icm20948_set_B2S_matrix(struct inv_icm20948 * s, int *b2s_mtx);
  125. int dmp_icm20948_set_fp_rate(struct inv_icm20948 * s, short accel_odr);
  126. int dmp_icm20948_reset_bac_states(struct inv_icm20948 * s);
  127. int dmp_icm20948_set_ped_y_ratio(struct inv_icm20948 * s, long ped_y_ratio);
  128. int dmp_icm20948_set_orientation_params(struct inv_icm20948 * s, int *orientation_params);
  129. #ifdef __cplusplus
  130. }
  131. #endif
  132. // _DMP_3_ICM20948_XFSD_H__
  133. #endif