MPU6050 library

Dependents:   CSSE4011_BLE_IMU_Project_rev2 Seeed_Tiny_BLE_Get_Started nrf51822_fix_i2c_spi_conflict balanceboard ... more

Committer:
yihui
Date:
Thu Nov 05 01:38:50 2015 +0000
Revision:
1:6aedb937cb38
Parent:
0:1b6dab73c06b
add mbed_i2c_clear() function; ; use mbed_i2c_clear to recover i2c bus when i2c is stuck

Who changed what in which revision?

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