inv_mpu_dmp_motion_driver.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. $License:
  3. Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
  4. See included License.txt for License information.
  5. $
  6. */
  7. /**
  8. * @addtogroup DRIVERS Sensor Driver Layer
  9. * @brief Hardware drivers to communicate with sensors via I2C.
  10. *
  11. * @{
  12. * @file inv_mpu_dmp_motion_driver.h
  13. * @brief DMP image and interface functions.
  14. * @details All functions are preceded by the dmp_ prefix to
  15. * differentiate among MPL and general driver function calls.
  16. */
  17. #ifndef _INV_MPU_DMP_MOTION_DRIVER_H_
  18. #define _INV_MPU_DMP_MOTION_DRIVER_H_
  19. #define TAP_X (0x01)
  20. #define TAP_Y (0x02)
  21. #define TAP_Z (0x04)
  22. #define TAP_XYZ (0x07)
  23. #define TAP_X_UP (0x01)
  24. #define TAP_X_DOWN (0x02)
  25. #define TAP_Y_UP (0x03)
  26. #define TAP_Y_DOWN (0x04)
  27. #define TAP_Z_UP (0x05)
  28. #define TAP_Z_DOWN (0x06)
  29. #define ANDROID_ORIENT_PORTRAIT (0x00)
  30. #define ANDROID_ORIENT_LANDSCAPE (0x01)
  31. #define ANDROID_ORIENT_REVERSE_PORTRAIT (0x02)
  32. #define ANDROID_ORIENT_REVERSE_LANDSCAPE (0x03)
  33. #define DMP_INT_GESTURE (0x01)
  34. #define DMP_INT_CONTINUOUS (0x02)
  35. #define DMP_FEATURE_TAP (0x001)
  36. #define DMP_FEATURE_ANDROID_ORIENT (0x002)
  37. #define DMP_FEATURE_LP_QUAT (0x004)
  38. #define DMP_FEATURE_PEDOMETER (0x008)
  39. #define DMP_FEATURE_6X_LP_QUAT (0x010)
  40. #define DMP_FEATURE_GYRO_CAL (0x020)
  41. #define DMP_FEATURE_SEND_RAW_ACCEL (0x040)
  42. #define DMP_FEATURE_SEND_RAW_GYRO (0x080)
  43. #define DMP_FEATURE_SEND_CAL_GYRO (0x100)
  44. #define INV_WXYZ_QUAT (0x100)
  45. /* Set up functions. */
  46. int dmp_load_motion_driver_firmware(void);
  47. int dmp_set_fifo_rate(unsigned short rate);
  48. int dmp_get_fifo_rate(unsigned short *rate);
  49. int dmp_enable_feature(unsigned short mask);
  50. int dmp_get_enabled_features(unsigned short *mask);
  51. int dmp_set_interrupt_mode(unsigned char mode);
  52. int dmp_set_orientation(unsigned short orient);
  53. int dmp_set_gyro_bias(long *bias);
  54. int dmp_set_accel_bias(long *bias);
  55. /* Tap functions. */
  56. int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char));
  57. int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh);
  58. int dmp_set_tap_axes(unsigned char axis);
  59. int dmp_set_tap_count(unsigned char min_taps);
  60. int dmp_set_tap_time(unsigned short time);
  61. int dmp_set_tap_time_multi(unsigned short time);
  62. int dmp_set_shake_reject_thresh(long sf, unsigned short thresh);
  63. int dmp_set_shake_reject_time(unsigned short time);
  64. int dmp_set_shake_reject_timeout(unsigned short time);
  65. /* Android orientation functions. */
  66. int dmp_register_android_orient_cb(void (*func)(unsigned char));
  67. /* LP quaternion functions. */
  68. int dmp_enable_lp_quat(unsigned char enable);
  69. int dmp_enable_6x_lp_quat(unsigned char enable);
  70. /* Pedometer functions. */
  71. int dmp_get_pedometer_step_count(unsigned long *count);
  72. int dmp_set_pedometer_step_count(unsigned long count);
  73. int dmp_get_pedometer_walk_time(unsigned long *time);
  74. int dmp_set_pedometer_walk_time(unsigned long time);
  75. /* DMP gyro calibration functions. */
  76. int dmp_enable_gyro_cal(unsigned char enable);
  77. /* Read function. This function should be called whenever the MPU interrupt is
  78. * detected.
  79. */
  80. int dmp_read_fifo(short *gyro, short *accel, long *quat,
  81. unsigned long *timestamp, short *sensors, unsigned char *more);
  82. #endif /* #ifndef _INV_MPU_DMP_MOTION_DRIVER_H_ */