motion library for mpu6050, mpu9250 and etc, supports i2c and spi

Committer:
yihui
Date:
Tue Jul 05 07:19:59 2016 +0000
Revision:
0:814475fdc553
initial

Who changed what in which revision?

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