527 lines
14 KiB
Groff
527 lines
14 KiB
Groff
|
|
.TH "D:/gitt/MicrochipFor32/bsp_MPU6050/inv_mpu.c" 3 "2022年 十一月 22日 星期二" "Version 1.0.0" "Bscpp" \" -*- nroff -*-
|
||
|
|
.ad l
|
||
|
|
.nh
|
||
|
|
.SH NAME
|
||
|
|
D:/gitt/MicrochipFor32/bsp_MPU6050/inv_mpu.c \- An I2C-based driver for Invensense gyroscopes\&.
|
||
|
|
|
||
|
|
.SH SYNOPSIS
|
||
|
|
.br
|
||
|
|
.PP
|
||
|
|
\fC#include <stdio\&.h>\fP
|
||
|
|
.br
|
||
|
|
\fC#include <stdlib\&.h>\fP
|
||
|
|
.br
|
||
|
|
\fC#include <string\&.h>\fP
|
||
|
|
.br
|
||
|
|
\fC#include <math\&.h>\fP
|
||
|
|
.br
|
||
|
|
\fC#include 'inv_mpu\&.h'\fP
|
||
|
|
.br
|
||
|
|
\fC#include 'inv_mpu_dmp_motion_driver\&.h'\fP
|
||
|
|
.br
|
||
|
|
\fC#include 'mpu6050\&.h'\fP
|
||
|
|
.br
|
||
|
|
\fC#include 'usart\&.h'\fP
|
||
|
|
.br
|
||
|
|
\fC#include 'varint\&.h'\fP
|
||
|
|
.br
|
||
|
|
|
||
|
|
.SS "类"
|
||
|
|
|
||
|
|
.in +1c
|
||
|
|
.ti -1c
|
||
|
|
.RI "struct \fBgyro_reg_s\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "struct \fBhw_s\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "struct \fBmotion_int_cache_s\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "struct \fBchip_cfg_s\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "struct \fBtest_s\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "struct \fBgyro_state_s\fP"
|
||
|
|
.br
|
||
|
|
.in -1c
|
||
|
|
.SS "宏定义"
|
||
|
|
|
||
|
|
.in +1c
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBMPU6050\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBMOTION_DRIVER_TARGET_MSP430\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBi2c_write\fP \fBMPU_Write_Len\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBi2c_read\fP \fBMPU_Read_Len\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBdelay_ms\fP HAL_Delay"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBget_ms\fP \fBmget_ms\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBlog_i\fP \fBlog_none\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBlog_e\fP \fBlog_none\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBfabs\fP fabsf"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBmin\fP(a, b) ((a<b)?a:b)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_I2C_MST_VDDIO\fP (0x80)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_FIFO_EN\fP (0x40)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_DMP_EN\fP (0x80)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_FIFO_RST\fP (0x04)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_DMP_RST\fP (0x08)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_FIFO_OVERFLOW\fP (0x10)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_DATA_RDY_EN\fP (0x01)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_DMP_INT_EN\fP (0x02)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_MOT_INT_EN\fP (0x40)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBITS_FSR\fP (0x18)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBITS_LPF\fP (0x07)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBITS_HPF\fP (0x07)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBITS_CLK\fP (0x07)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_FIFO_SIZE_1024\fP (0x40)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_FIFO_SIZE_2048\fP (0x80)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_FIFO_SIZE_4096\fP (0xC0)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_RESET\fP (0x80)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_SLEEP\fP (0x40)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_S0_DELAY_EN\fP (0x01)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_S2_DELAY_EN\fP (0x04)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBITS_SLAVE_LENGTH\fP (0x0F)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_SLAVE_BYTE_SW\fP (0x40)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_SLAVE_GROUP\fP (0x10)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_SLAVE_EN\fP (0x80)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_I2C_READ\fP (0x80)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBITS_I2C_MASTER_DLY\fP (0x1F)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_AUX_IF_EN\fP (0x20)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_ACTL\fP (0x80)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_LATCH_EN\fP (0x20)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_ANY_RD_CLR\fP (0x10)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_BYPASS_EN\fP (0x02)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBITS_WOM_EN\fP (0xC0)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_LPA_CYCLE\fP (0x20)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_STBY_XA\fP (0x20)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_STBY_YA\fP (0x10)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_STBY_ZA\fP (0x08)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_STBY_XG\fP (0x04)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_STBY_YG\fP (0x02)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_STBY_ZG\fP (0x01)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_STBY_XYZA\fP (\fBBIT_STBY_XA\fP | \fBBIT_STBY_YA\fP | \fBBIT_STBY_ZA\fP)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBBIT_STBY_XYZG\fP (\fBBIT_STBY_XG\fP | \fBBIT_STBY_YG\fP | \fBBIT_STBY_ZG\fP)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBMAX_PACKET_LENGTH\fP (12)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBLOAD_CHUNK\fP (16)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "#define \fBq30\fP 1073741824\&.0f"
|
||
|
|
.br
|
||
|
|
.in -1c
|
||
|
|
.SS "枚举"
|
||
|
|
|
||
|
|
.in +1c
|
||
|
|
.ti -1c
|
||
|
|
.RI "enum \fBlpf_e\fP { \fBINV_FILTER_256HZ_NOLPF2\fP = 0, \fBINV_FILTER_188HZ\fP, \fBINV_FILTER_98HZ\fP, \fBINV_FILTER_42HZ\fP, \fBINV_FILTER_20HZ\fP, \fBINV_FILTER_10HZ\fP, \fBINV_FILTER_5HZ\fP, \fBINV_FILTER_2100HZ_NOLPF\fP, \fBNUM_FILTER\fP }"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "enum \fBgyro_fsr_e\fP { \fBINV_FSR_250DPS\fP = 0, \fBINV_FSR_500DPS\fP, \fBINV_FSR_1000DPS\fP, \fBINV_FSR_2000DPS\fP, \fBNUM_GYRO_FSR\fP }"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "enum \fBaccel_fsr_e\fP { \fBINV_FSR_2G\fP = 0, \fBINV_FSR_4G\fP, \fBINV_FSR_8G\fP, \fBINV_FSR_16G\fP, \fBNUM_ACCEL_FSR\fP }"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "enum \fBclock_sel_e\fP { \fBINV_CLK_INTERNAL\fP = 0, \fBINV_CLK_PLL\fP, \fBNUM_CLK\fP }"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "enum \fBlp_accel_rate_e\fP { \fBINV_LPA_1_25HZ\fP, \fBINV_LPA_5HZ\fP, \fBINV_LPA_20HZ\fP, \fBINV_LPA_40HZ\fP }"
|
||
|
|
.br
|
||
|
|
.in -1c
|
||
|
|
.SS "函数"
|
||
|
|
|
||
|
|
.in +1c
|
||
|
|
.ti -1c
|
||
|
|
.RI "void \fBlog_none\fP (char *fmt,\&.\&.\&.)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "static int \fBset_int_enable\fP (unsigned char enable)"
|
||
|
|
.br
|
||
|
|
.RI "Enable/disable data ready interrupt\&. If the DMP is on, the DMP interrupt is enabled\&. Otherwise, the data ready interrupt is used\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_reg_dump\fP (void)"
|
||
|
|
.br
|
||
|
|
.RI "Register dump for testing\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_read_reg\fP (unsigned char \fBreg\fP, unsigned char *data)"
|
||
|
|
.br
|
||
|
|
.RI "Read from a single register\&. NOTE: The memory and FIFO read/write registers cannot be accessed\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_init\fP (void)"
|
||
|
|
.br
|
||
|
|
.RI "Initialize hardware\&. Initial configuration:
|
||
|
|
.br
|
||
|
|
Gyro FSR: +/- 2000DPS
|
||
|
|
.br
|
||
|
|
Accel FSR +/- 2G
|
||
|
|
.br
|
||
|
|
DLPF: 42Hz
|
||
|
|
.br
|
||
|
|
FIFO rate: 50Hz
|
||
|
|
.br
|
||
|
|
Clock source: Gyro PLL
|
||
|
|
.br
|
||
|
|
FIFO: Disabled\&.
|
||
|
|
.br
|
||
|
|
Data ready interrupt: Disabled, active low, unlatched\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_lp_accel_mode\fP (unsigned char rate)"
|
||
|
|
.br
|
||
|
|
.RI "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:
|
||
|
|
.br
|
||
|
|
MPU6050: 1\&.25Hz, 5Hz, 20Hz, 40Hz
|
||
|
|
.br
|
||
|
|
MPU6500: 1\&.25Hz, 2\&.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
|
||
|
|
.br
|
||
|
|
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\&.
|
||
|
|
.br
|
||
|
|
To select a fractional wake-up frequency, round down the value passed to \fIrate\fP\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_gyro_reg\fP (short *data, unsigned long *timestamp)"
|
||
|
|
.br
|
||
|
|
.RI "Read raw gyro data directly from the registers\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_accel_reg\fP (short *data, unsigned long *timestamp)"
|
||
|
|
.br
|
||
|
|
.RI "Read raw accel data directly from the registers\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_temperature\fP (long *data, unsigned long *timestamp)"
|
||
|
|
.br
|
||
|
|
.RI "Read temperature data directly from the registers\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_accel_bias\fP (const long *accel_bias)"
|
||
|
|
.br
|
||
|
|
.RI "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\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_reset_fifo\fP (void)"
|
||
|
|
.br
|
||
|
|
.RI "Reset FIFO read/write pointers\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_gyro_fsr\fP (unsigned short *fsr)"
|
||
|
|
.br
|
||
|
|
.RI "Get the gyro full-scale range\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_gyro_fsr\fP (unsigned short fsr)"
|
||
|
|
.br
|
||
|
|
.RI "Set the gyro full-scale range\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_accel_fsr\fP (unsigned char *fsr)"
|
||
|
|
.br
|
||
|
|
.RI "Get the accel full-scale range\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_accel_fsr\fP (unsigned char fsr)"
|
||
|
|
.br
|
||
|
|
.RI "Set the accel full-scale range\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_lpf\fP (unsigned short *lpf)"
|
||
|
|
.br
|
||
|
|
.RI "Get the current DLPF setting\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_lpf\fP (unsigned short lpf)"
|
||
|
|
.br
|
||
|
|
.RI "Set digital low pass filter\&. The following LPF settings are supported: 188, 98, 42, 20, 10, 5\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_sample_rate\fP (unsigned short *rate)"
|
||
|
|
.br
|
||
|
|
.RI "Get sampling rate\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_sample_rate\fP (unsigned short rate)"
|
||
|
|
.br
|
||
|
|
.RI "Set sampling rate\&. Sampling rate must be between 4Hz and 1kHz\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_compass_sample_rate\fP (unsigned short *rate)"
|
||
|
|
.br
|
||
|
|
.RI "Get compass sampling rate\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_compass_sample_rate\fP (unsigned short rate)"
|
||
|
|
.br
|
||
|
|
.RI "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\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_gyro_sens\fP (float *sens)"
|
||
|
|
.br
|
||
|
|
.RI "Get gyro sensitivity scale factor\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_accel_sens\fP (unsigned short *sens)"
|
||
|
|
.br
|
||
|
|
.RI "Get accel sensitivity scale factor\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_fifo_config\fP (unsigned char *sensors)"
|
||
|
|
.br
|
||
|
|
.RI "Get current FIFO configuration\&. \fIsensors\fP can contain a combination of the following flags:
|
||
|
|
.br
|
||
|
|
INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
|
||
|
|
.br
|
||
|
|
INV_XYZ_GYRO
|
||
|
|
.br
|
||
|
|
INV_XYZ_ACCEL "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_configure_fifo\fP (unsigned char sensors)"
|
||
|
|
.br
|
||
|
|
.RI "Select which sensors are pushed to FIFO\&. \fIsensors\fP can contain a combination of the following flags:
|
||
|
|
.br
|
||
|
|
INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
|
||
|
|
.br
|
||
|
|
INV_XYZ_GYRO
|
||
|
|
.br
|
||
|
|
INV_XYZ_ACCEL "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_power_state\fP (unsigned char *power_on)"
|
||
|
|
.br
|
||
|
|
.RI "Get current power state\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_sensors\fP (unsigned char sensors)"
|
||
|
|
.br
|
||
|
|
.RI "Turn specific sensors on/off\&. \fIsensors\fP can contain a combination of the following flags:
|
||
|
|
.br
|
||
|
|
INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
|
||
|
|
.br
|
||
|
|
INV_XYZ_GYRO
|
||
|
|
.br
|
||
|
|
INV_XYZ_ACCEL
|
||
|
|
.br
|
||
|
|
INV_XYZ_COMPASS "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_int_status\fP (short *status)"
|
||
|
|
.br
|
||
|
|
.RI "Read the MPU interrupt status registers\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_read_fifo\fP (short *gyro, short *accel, unsigned long *timestamp, unsigned char *sensors, unsigned char *more)"
|
||
|
|
.br
|
||
|
|
.RI "Get one packet from the FIFO\&. If \fIsensors\fP does not contain a particular sensor, disregard the data returned to that pointer\&.
|
||
|
|
.br
|
||
|
|
\fIsensors\fP can contain a combination of the following flags:
|
||
|
|
.br
|
||
|
|
INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
|
||
|
|
.br
|
||
|
|
INV_XYZ_GYRO
|
||
|
|
.br
|
||
|
|
INV_XYZ_ACCEL
|
||
|
|
.br
|
||
|
|
If the FIFO has no new data, \fIsensors\fP will be zero\&.
|
||
|
|
.br
|
||
|
|
If the FIFO is disabled, \fIsensors\fP will be zero and this function will return a non-zero error code\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_read_fifo_stream\fP (unsigned short length, unsigned char *data, unsigned char *more)"
|
||
|
|
.br
|
||
|
|
.RI "Get one unparsed packet from the FIFO\&. This function should be used if the packet is to be parsed elsewhere\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_bypass\fP (unsigned char bypass_on)"
|
||
|
|
.br
|
||
|
|
.RI "Set device to bypass mode\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_int_level\fP (unsigned char active_low)"
|
||
|
|
.br
|
||
|
|
.RI "Set interrupt level\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_int_latched\fP (unsigned char enable)"
|
||
|
|
.br
|
||
|
|
.RI "Enable latched interrupts\&. Any MPU register will clear the interrupt\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "static int \fBget_accel_prod_shift\fP (float *st_shift)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "static int \fBaccel_self_test\fP (long *bias_regular, long *bias_st)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "static int \fBgyro_self_test\fP (long *bias_regular, long *bias_st)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "static int \fBget_st_biases\fP (long *gyro, long *accel, unsigned char hw_test)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_run_self_test\fP (long *gyro, long *accel)"
|
||
|
|
.br
|
||
|
|
.RI "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\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_write_mem\fP (unsigned short mem_addr, unsigned short length, unsigned char *data)"
|
||
|
|
.br
|
||
|
|
.RI "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\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_read_mem\fP (unsigned short mem_addr, unsigned short length, unsigned char *data)"
|
||
|
|
.br
|
||
|
|
.RI "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\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_load_firmware\fP (unsigned short length, const unsigned char *firmware, unsigned short start_addr, unsigned short sample_rate)"
|
||
|
|
.br
|
||
|
|
.RI "Load and verify DMP image\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_set_dmp_state\fP (unsigned char enable)"
|
||
|
|
.br
|
||
|
|
.RI "Enable/disable DMP support\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_dmp_state\fP (unsigned char *enabled)"
|
||
|
|
.br
|
||
|
|
.RI "Get DMP state\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBsetup_compass\fP (void)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_compass_reg\fP (short *data, unsigned long *timestamp)"
|
||
|
|
.br
|
||
|
|
.RI "Read raw compass data\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_get_compass_fsr\fP (unsigned short *fsr)"
|
||
|
|
.br
|
||
|
|
.RI "Get the compass full-scale range\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "int \fBmpu_lp_motion_interrupt\fP (unsigned short thresh, unsigned char time, unsigned char lpa_freq)"
|
||
|
|
.br
|
||
|
|
.RI "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\&. "
|
||
|
|
.ti -1c
|
||
|
|
.RI "\fBu8\fP \fBrun_self_test\fP (void)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "unsigned short \fBinv_orientation_matrix_to_scalar\fP (const signed char *mtx)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "unsigned short \fBinv_row_2_scale\fP (const signed char *row)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "void \fBmget_ms\fP (unsigned long *time)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "\fBu8\fP \fBmpu_dmp_init\fP (void)"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "\fBu8\fP \fBmpu_dmp_get_data\fP (float *pitch, float *roll, float *yaw)"
|
||
|
|
.br
|
||
|
|
.in -1c
|
||
|
|
.SS "变量"
|
||
|
|
|
||
|
|
.in +1c
|
||
|
|
.ti -1c
|
||
|
|
.RI "const struct \fBgyro_reg_s\fP \fBreg\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "const struct \fBhw_s\fP \fBhw\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "const struct \fBtest_s\fP \fBtest\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "static struct \fBgyro_state_s\fP \fBst\fP"
|
||
|
|
.br
|
||
|
|
.ti -1c
|
||
|
|
.RI "static signed char \fBgyro_orientation\fP [9]"
|
||
|
|
.br
|
||
|
|
.in -1c
|
||
|
|
.SH "详细描述"
|
||
|
|
.PP
|
||
|
|
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)
|
||
|
|
.PP
|
||
|
|
在文件 \fBinv_mpu\&.c\fP 中定义\&.
|
||
|
|
.SH "宏定义说明"
|
||
|
|
.PP
|
||
|
|
.SS "#define LOAD_CHUNK (16)"
|
||
|
|
|
||
|
|
.SH "作者"
|
||
|
|
.PP
|
||
|
|
由 Doyxgen 通过分析 Bscpp 的 源代码自动生成\&.
|