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