D:/gitt/MicrochipFor32/bsp_MPU6050/inv_mpu.h 文件参考D:/gitt/MicrochipFor32/bsp_MPU6050/inv_mpu.hAn I2C-based driver for Invensense gyroscopes. #include "main.h"#include "varint.h"inv_mpu.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:类 struct int_param_s宏定义 #define DEFAULT_MPU_HZ (100)#define INV_X_GYRO (0x40)#define INV_Y_GYRO (0x20)#define INV_Z_GYRO (0x10)#define INV_XYZ_GYRO (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)#define INV_XYZ_ACCEL (0x08)#define INV_XYZ_COMPASS (0x01)#define MPU_INT_STATUS_DATA_READY (0x0001)#define MPU_INT_STATUS_DMP (0x0002)#define MPU_INT_STATUS_PLL_READY (0x0004)#define MPU_INT_STATUS_I2C_MST (0x0008)#define MPU_INT_STATUS_FIFO_OVERFLOW (0x0010)#define MPU_INT_STATUS_ZMOT (0x0020)#define MPU_INT_STATUS_MOT (0x0040)#define MPU_INT_STATUS_FREE_FALL (0x0080)#define MPU_INT_STATUS_DMP_0 (0x0100)#define MPU_INT_STATUS_DMP_1 (0x0200)#define MPU_INT_STATUS_DMP_2 (0x0400)#define MPU_INT_STATUS_DMP_3 (0x0800)#define MPU_INT_STATUS_DMP_4 (0x1000)#define MPU_INT_STATUS_DMP_5 (0x2000)函数 int mpu_init (void)Initialize hardware. Initial configuration:Gyro FSR: +/- 2000DPSAccel FSR +/- 2GDLPF: 42HzFIFO rate: 50HzClock source: Gyro PLLFIFO: Disabled.Data ready interrupt: Disabled, active low, unlatched. int mpu_init_slave (void)int mpu_set_bypass (unsigned char bypass_on)Set device to bypass mode. int mpu_lp_accel_mode (unsigned char rate)Enter low-power accel-only mode. In low-power accel mode, the chip goes to sleep and only wakes up to sample the accelerometer at one of the following frequencies: MPU6050: 1.25Hz, 5Hz, 20Hz, 40Hz MPU6500: 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz If the requested rate is not one listed above, the device will be set to the next highest rate. Requesting a rate above the maximum supported frequency will result in an error. To select a fractional wake-up frequency, round down the value passed to rate. int mpu_lp_motion_interrupt (unsigned short thresh, unsigned char time, unsigned char lpa_freq)Enters LP accel motion interrupt mode. The behavior of this feature is very different between the MPU6050 and the MPU6500. Each chip's version of this feature is explained below. int mpu_set_int_level (unsigned char active_low)Set interrupt level. int mpu_set_int_latched (unsigned char enable)Enable latched interrupts. Any MPU register will clear the interrupt. int mpu_set_dmp_state (unsigned char enable)Enable/disable DMP support. int mpu_get_dmp_state (unsigned char *enabled)Get DMP state. int mpu_get_lpf (unsigned short *lpf)Get the current DLPF setting. int mpu_set_lpf (unsigned short lpf)Set digital low pass filter. The following LPF settings are supported: 188, 98, 42, 20, 10, 5. int mpu_get_gyro_fsr (unsigned short *fsr)Get the gyro full-scale range. int mpu_set_gyro_fsr (unsigned short fsr)Set the gyro full-scale range. int mpu_get_accel_fsr (unsigned char *fsr)Get the accel full-scale range. int mpu_set_accel_fsr (unsigned char fsr)Set the accel full-scale range. int mpu_get_compass_fsr (unsigned short *fsr)Get the compass full-scale range. int mpu_get_gyro_sens (float *sens)Get gyro sensitivity scale factor. int mpu_get_accel_sens (unsigned short *sens)Get accel sensitivity scale factor. int mpu_get_sample_rate (unsigned short *rate)Get sampling rate. int mpu_set_sample_rate (unsigned short rate)Set sampling rate. Sampling rate must be between 4Hz and 1kHz. int mpu_get_compass_sample_rate (unsigned short *rate)Get compass sampling rate. int mpu_set_compass_sample_rate (unsigned short rate)Set compass sampling rate. The compass on the auxiliary I2C bus is read by the MPU hardware at a maximum of 100Hz. The actual rate can be set to a fraction of the gyro sampling rate. int mpu_get_fifo_config (unsigned char *sensors)Get current FIFO configuration. sensors can contain a combination of the following flags: INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO INV_XYZ_GYRO INV_XYZ_ACCEL int mpu_configure_fifo (unsigned char sensors)Select which sensors are pushed to FIFO. sensors can contain a combination of the following flags: INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO INV_XYZ_GYRO INV_XYZ_ACCEL int mpu_get_power_state (unsigned char *power_on)Get current power state. int mpu_set_sensors (unsigned char sensors)Turn specific sensors on/off. 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_XYZ_COMPASS int mpu_set_accel_bias (const long *accel_bias)Push biases to the accel bias registers. This function expects biases relative to the current sensor output, and these biases will be added to the factory-supplied values. int mpu_get_gyro_reg (short *data, unsigned long *timestamp)Read raw gyro data directly from the registers. int mpu_get_accel_reg (short *data, unsigned long *timestamp)Read raw accel data directly from the registers. int mpu_get_compass_reg (short *data, unsigned long *timestamp)Read raw compass data. int mpu_get_temperature (long *data, unsigned long *timestamp)Read temperature data directly from the registers. int mpu_get_int_status (short *status)Read the MPU interrupt status registers. int mpu_read_fifo (short *gyro, short *accel, unsigned long *timestamp, unsigned char *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 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 mpu_read_fifo_stream (unsigned short length, unsigned char *data, unsigned char *more)Get one unparsed packet from the FIFO. This function should be used if the packet is to be parsed elsewhere. int mpu_reset_fifo (void)Reset FIFO read/write pointers. int mpu_write_mem (unsigned short mem_addr, unsigned short length, unsigned char *data)Write to the DMP memory. This function prevents I2C writes past the bank boundaries. The DMP memory is only accessible when the chip is awake. int mpu_read_mem (unsigned short mem_addr, unsigned short length, unsigned char *data)Read from the DMP memory. This function prevents I2C reads past the bank boundaries. The DMP memory is only accessible when the chip is awake. int mpu_load_firmware (unsigned short length, const unsigned char *firmware, unsigned short start_addr, unsigned short sample_rate)Load and verify DMP image. int mpu_reg_dump (void)Register dump for testing. int mpu_read_reg (unsigned char reg, unsigned char *data)Read from a single register. NOTE: The memory and FIFO read/write registers cannot be accessed. int mpu_run_self_test (long *gyro, long *accel)Trigger gyro/accel/compass self-test. On success/error, the self-test returns a mask representing the sensor(s) that failed. For each bit, a one (1) represents a "pass" case; conversely, a zero (0) indicates a failure. int mpu_register_tap_cb (void(*func)(unsigned char, unsigned char))void mget_ms (unsigned long *time)unsigned short inv_row_2_scale (const signed char *row)unsigned short inv_orientation_matrix_to_scalar (const signed char *mtx)u8 run_self_test (void)u8 mpu_dmp_init (void)u8 mpu_dmp_get_data (float *pitch, float *roll, float *yaw)详细描述An I2C-based driver for Invensense gyroscopes. This driver currently works for the following devices: MPU6050 MPU6500 MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus) MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
在文件 inv_mpu.h 中定义.