.TH "D:/gitt/MicrochipFor32/bsp_MPU6050/inv_mpu.h" 3 "2022年 十一月 22日 星期二" "Version 1.0.0" "Bscpp" \" -*- nroff -*- .ad l .nh .SH NAME D:/gitt/MicrochipFor32/bsp_MPU6050/inv_mpu.h \- An I2C-based driver for Invensense gyroscopes\&. .SH SYNOPSIS .br .PP \fC#include 'main\&.h'\fP .br \fC#include 'varint\&.h'\fP .br .SS "类" .in +1c .ti -1c .RI "struct \fBint_param_s\fP" .br .in -1c .SS "宏定义" .in +1c .ti -1c .RI "#define \fBDEFAULT_MPU_HZ\fP (100)" .br .ti -1c .RI "#define \fBINV_X_GYRO\fP (0x40)" .br .ti -1c .RI "#define \fBINV_Y_GYRO\fP (0x20)" .br .ti -1c .RI "#define \fBINV_Z_GYRO\fP (0x10)" .br .ti -1c .RI "#define \fBINV_XYZ_GYRO\fP (\fBINV_X_GYRO\fP | \fBINV_Y_GYRO\fP | \fBINV_Z_GYRO\fP)" .br .ti -1c .RI "#define \fBINV_XYZ_ACCEL\fP (0x08)" .br .ti -1c .RI "#define \fBINV_XYZ_COMPASS\fP (0x01)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_DATA_READY\fP (0x0001)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_DMP\fP (0x0002)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_PLL_READY\fP (0x0004)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_I2C_MST\fP (0x0008)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_FIFO_OVERFLOW\fP (0x0010)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_ZMOT\fP (0x0020)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_MOT\fP (0x0040)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_FREE_FALL\fP (0x0080)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_DMP_0\fP (0x0100)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_DMP_1\fP (0x0200)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_DMP_2\fP (0x0400)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_DMP_3\fP (0x0800)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_DMP_4\fP (0x1000)" .br .ti -1c .RI "#define \fBMPU_INT_STATUS_DMP_5\fP (0x2000)" .br .in -1c .SS "函数" .in +1c .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_init_slave\fP (void)" .br .ti -1c .RI "int \fBmpu_set_bypass\fP (unsigned char bypass_on)" .br .RI "Set device to bypass mode\&. " .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_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 "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 "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 \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_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_compass_fsr\fP (unsigned short *fsr)" .br .RI "Get the compass full-scale range\&. " .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_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_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_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_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_compass_reg\fP (short *data, unsigned long *timestamp)" .br .RI "Read raw compass data\&. " .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_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_reset_fifo\fP (void)" .br .RI "Reset FIFO read/write pointers\&. " .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_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_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_register_tap_cb\fP (void(*func)(unsigned char, unsigned char))" .br .ti -1c .RI "void \fBmget_ms\fP (unsigned long *time)" .br .ti -1c .RI "unsigned short \fBinv_row_2_scale\fP (const signed char *row)" .br .ti -1c .RI "unsigned short \fBinv_orientation_matrix_to_scalar\fP (const signed char *mtx)" .br .ti -1c .RI "\fBu8\fP \fBrun_self_test\fP (void)" .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 .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\&.h\fP 中定义\&. .SH "作者" .PP 由 Doyxgen 通过分析 Bscpp 的 源代码自动生成\&.