Classes | Defines | Functions | Variables
inv_mpu_dmp_motion_driver.cpp File Reference
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "inv_mpu.h"
#include "inv_mpu_dmp_motion_driver.h"
#include "dmpKey.h"
#include "dmpmap.h"
Include dependency graph for inv_mpu_dmp_motion_driver.cpp:

Go to the source code of this file.

Classes

struct  dmp_s

Defines

#define CFG_15   (2727)
#define CFG_16   (2746)
#define CFG_20   (2224)
#define CFG_23   (2745)
#define CFG_27   (2742)
#define CFG_6   (2753)
#define CFG_7   (1205)
#define CFG_8   (2718)
#define CFG_ANDROID_ORIENT_INT   (1853)
#define CFG_AUTH   (1035)
#define CFG_DR_INT   (1029)
#define CFG_EXT_GYRO_BIAS   (1189)
#define CFG_FIFO_ON_EVENT   (2690)
#define CFG_FLICK_IN   (2573)
#define CFG_GYRO_RAW_DATA   (2722)
#define CFG_LP_QUAT   (2712)
#define CFG_MOTION_BIAS   (1208)
#define CGNOTICE_INTR   (2620)
#define CPASS_BIAS_X   (35 * 16 + 4)
#define CPASS_BIAS_Y   (35 * 16 + 8)
#define CPASS_BIAS_Z   (35 * 16 + 12)
#define CPASS_MTX_00   (36 * 16)
#define CPASS_MTX_01   (36 * 16 + 4)
#define CPASS_MTX_02   (36 * 16 + 8)
#define CPASS_MTX_10   (36 * 16 + 12)
#define CPASS_MTX_11   (37 * 16)
#define CPASS_MTX_12   (37 * 16 + 4)
#define CPASS_MTX_20   (37 * 16 + 8)
#define CPASS_MTX_21   (37 * 16 + 12)
#define CPASS_MTX_22   (43 * 16 + 12)
#define D_0_104   (104)
#define D_0_108   (108)
#define D_0_163   (163)
#define D_0_188   (188)
#define D_0_192   (192)
#define D_0_22   (22+512)
#define D_0_224   (224)
#define D_0_228   (228)
#define D_0_232   (232)
#define D_0_236   (236)
#define D_0_24   (24+512)
#define D_0_36   (36)
#define D_0_52   (52)
#define D_0_96   (96)
#define D_1_10   (256 + 10)
#define D_1_106   (256 + 106)
#define D_1_108   (256 + 108)
#define D_1_112   (256 + 112)
#define D_1_128   (256 + 144)
#define D_1_152   (256 + 12)
#define D_1_160   (256 + 160)
#define D_1_176   (256 + 176)
#define D_1_178   (256 + 178)
#define D_1_2   (256 + 2)
#define D_1_218   (256 + 218)
#define D_1_232   (256 + 232)
#define D_1_236   (256 + 236)
#define D_1_24   (256 + 24)
#define D_1_240   (256 + 240)
#define D_1_244   (256 + 244)
#define D_1_250   (256 + 250)
#define D_1_252   (256 + 252)
#define D_1_28   (256 + 28)
#define D_1_36   (256 + 36)
#define D_1_4   (256 + 4)
#define D_1_40   (256 + 40)
#define D_1_44   (256 + 44)
#define D_1_72   (256 + 72)
#define D_1_74   (256 + 74)
#define D_1_79   (256 + 79)
#define D_1_8   (256 + 8)
#define D_1_88   (256 + 88)
#define D_1_90   (256 + 90)
#define D_1_92   (256 + 92)
#define D_1_96   (256 + 96)
#define D_1_98   (256 + 98)
#define D_2_108   (512 + 108)
#define D_2_12   (512 + 12)
#define D_2_208   (512 + 208)
#define D_2_224   (512 + 224)
#define D_2_236   (512 + 236)
#define D_2_244   (512 + 244)
#define D_2_248   (512 + 248)
#define D_2_252   (512 + 252)
#define D_2_96   (512 + 96)
#define D_ACCEL_BIAS   (660)
#define D_ACSX   (40 * 16 + 4)
#define D_ACSY   (40 * 16 + 8)
#define D_ACSZ   (40 * 16 + 12)
#define D_ACT0   (40 * 16)
#define D_AUTH_A   (1000)
#define D_AUTH_B   (1004)
#define D_AUTH_IN   (996)
#define D_AUTH_OUT   (992)
#define D_EXT_GYRO_BIAS_X   (61 * 16)
#define D_EXT_GYRO_BIAS_Y   (61 * 16) + 4
#define D_EXT_GYRO_BIAS_Z   (61 * 16) + 8
#define D_HOST_NO_MOT   (976)
#define D_ORIENT_GAP   (76)
#define D_PEDSTD_BP_A1   (768 + 0x4C)
#define D_PEDSTD_BP_A2   (768 + 0x48)
#define D_PEDSTD_BP_A3   (768 + 0x44)
#define D_PEDSTD_BP_A4   (768 + 0x40)
#define D_PEDSTD_BP_B   (768 + 0x1C)
#define D_PEDSTD_CLIP   (768 + 0x6C)
#define D_PEDSTD_DECI   (768 + 0xA0)
#define D_PEDSTD_HP_A   (768 + 0x78)
#define D_PEDSTD_HP_B   (768 + 0x7C)
#define D_PEDSTD_INT_THRSH   (768 + 0x68)
#define D_PEDSTD_PEAK   (768 + 0X94)
#define D_PEDSTD_PEAKTHRSH   (768 + 0x98)
#define D_PEDSTD_SB   (768 + 0x28)
#define D_PEDSTD_SB_TIME   (768 + 0x2C)
#define D_PEDSTD_STEPCTR   (768 + 0x60)
#define D_PEDSTD_TIMECTR   (964)
#define D_PEDSTD_TIMH   (768 + 0x2E)
#define D_PEDSTD_TIML   (768 + 0x2A)
#define D_TILT0_H   (48)
#define D_TILT0_L   (50)
#define D_TILT1_H   (52)
#define D_TILT1_L   (54)
#define D_TILT2_H   (56)
#define D_TILT2_L   (58)
#define D_TILT3_H   (60)
#define D_TILT3_L   (62)
#define delay_ms   delay
#define DMP_CODE_SIZE   (3062)
#define DMP_FEATURE_SEND_ANY_GYRO
#define DMP_SAMPLE_RATE   (200)
#define DO_NOT_UPDATE_PROP_ROT   (1839)
#define END_COMPARE_Y_X   (1484)
#define END_COMPARE_Y_X_TMP   (1407)
#define END_COMPARE_Y_X_TMP2   (1455)
#define END_COMPARE_Y_X_TMP3   (1434)
#define END_ORIENT   (1884)
#define END_ORIENT_TEMP   (1866)
#define END_PREDICTION_UPDATE   (1761)
#define FCFG_1   (1062)
#define FCFG_2   (1066)
#define FCFG_3   (1088)
#define FCFG_6   (1106)
#define FCFG_7   (1073)
#define FIFO_CORRUPTION_CHECK
#define FLAT_STATE_END   (1713)
#define FLAT_STATE_END_TEMP   (1683)
#define FLICK_COUNTER   (45 * 16 + 8)
#define FLICK_LOWER   (45 * 16 + 12)
#define FLICK_MSG   (45 * 16 + 4)
#define FLICK_UPPER   (46 * 16 + 12)
#define GYRO_SF   (46850825LL * 200 / DMP_SAMPLE_RATE)
#define INT_SRC_ANDROID_ORIENT   (0x08)
#define INT_SRC_TAP   (0x01)
#define log_e(...)   do {} while (0)
#define log_i(...)   do {} while (0)
#define MAX_PACKET_LENGTH   (32)
#define QUAT_ERROR_THRESH   (1L<<24)
#define QUAT_MAG_SQ_MAX   (QUAT_MAG_SQ_NORMALIZED + QUAT_ERROR_THRESH)
#define QUAT_MAG_SQ_MIN   (QUAT_MAG_SQ_NORMALIZED - QUAT_ERROR_THRESH)
#define QUAT_MAG_SQ_NORMALIZED   (1L<<28)
#define SKIP_END_COMPARE   (1435)
#define SKIP_SWING_END_1   (1551)
#define SKIP_SWING_END_2   (1566)
#define SKIP_SWING_END_3   (1588)
#define SKIP_X_GRT_Y_TMP   (1359)
#define SWING_END_1   (1550)
#define SWING_END_2   (1565)
#define SWING_END_3   (1587)
#define SWING_END_4   (1616)
#define TEMPLABEL   (2324)
#define TILTG75_START   (1672)
#define TILTL75_END   (1669)
#define TILTL75_START   (1643)
#define UPDATE_PROP_ROT   (1835)
#define X_GRT_Y   (1408)
#define X_GRT_Y_TMP   (1358)
#define X_GRT_Y_TMP2   (1379)

Functions

int dmp_enable_6x_lp_quat (unsigned char enable)
 Generate 6-axis quaternions from the dmp-> In this driver, the 3-axis and 6-axis DMP quaternion features are mutually exclusive.
int dmp_enable_feature (unsigned short mask)
 Enable DMP features. The following #define's are used in the input mask:
DMP_FEATURE_TAP
DMP_FEATURE_ANDROID_ORIENT
DMP_FEATURE_LP_QUAT
DMP_FEATURE_6X_LP_QUAT
DMP_FEATURE_GYRO_CAL
DMP_FEATURE_SEND_RAW_ACCEL
DMP_FEATURE_SEND_RAW_GYRO
NOTE: DMP_FEATURE_LP_QUAT and DMP_FEATURE_6X_LP_QUAT are mutually exclusive.
NOTE: DMP_FEATURE_SEND_RAW_GYRO and DMP_FEATURE_SEND_CAL_GYRO are also mutually exclusive.
int dmp_enable_gyro_cal (unsigned char enable)
 Calibrate the gyro data in the dmp-> After eight seconds of no motion, the DMP will compute gyro biases and subtract them from the quaternion output. If dmp_enable_feature is called with DMP_FEATURE_SEND_CAL_GYRO, the biases will also be subtracted from the gyro output.
int dmp_enable_lp_quat (unsigned char enable)
 Generate 3-axis quaternions from the dmp-> In this driver, the 3-axis and 6-axis DMP quaternion features are mutually exclusive.
int dmp_get_enabled_features (unsigned short *mask)
 Get list of currently enabled DMP features.
int dmp_get_fifo_rate (unsigned short *rate)
 Get DMP output rate.
void dmp_init_structures ()
int dmp_load_motion_driver_firmware (void)
 Load the DMP with this image.
int dmp_read_fifo (short *gyro, short *accel, long *quat, unsigned long *timestamp, short *sensors, unsigned char *more)
 Get one packet from the FIFO. If sensors does not contain a particular sensor, disregard the data returned to that pointer.
sensors can contain a combination of the following flags:
INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
INV_XYZ_GYRO
INV_XYZ_ACCEL
INV_WXYZ_QUAT
If the FIFO has no new data, sensors will be zero.
If the FIFO is disabled, sensors will be zero and this function will return a non-zero error code.
int dmp_select_device (int device)
int dmp_set_accel_bias (long *bias)
 Push accel biases to the dmp-> These biases will be removed from the DMP 6-axis quaternion.
int dmp_set_fifo_rate (unsigned short rate)
 Set DMP output rate. Only used when DMP is on.
int dmp_set_gyro_bias (long *bias)
 Push gyro biases to the dmp-> Because the gyro integration is handled in the DMP, any gyro biases calculated by the MPL should be pushed down to DMP memory to remove 3-axis quaternion drift.
NOTE: If the DMP-based gyro calibration is enabled, the DMP will overwrite the biases written to this location once a new one is computed.
int dmp_set_interrupt_mode (unsigned char mode)
 Specify when a DMP interrupt should occur. A DMP interrupt can be configured to trigger on either of the two conditions below:
a. One FIFO period has elapsed (set by mpu_set_sample_rate).
b. A tap event has been detected.
int dmp_set_orientation (unsigned short orient)
 Push gyro and accel orientation to the dmp-> The orientation is represented here as the output of inv_orientation_matrix_to_scalar.

Variables

static int deviceIndex = 0
struct dmp_sdmp
struct dmp_s dmpArray [MPU_MAX_DEVICES]
const unsigned char dmp_memory[DMP_CODE_SIZEPROGMEM
static const unsigned short sStartAddress = 0x0400


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:57