Embedded MotionDriver 6.1 Sourced from InvenSense

Embed: (wiki syntax)

« Back to documentation index

inv_mpu.c File Reference

inv_mpu.c File Reference

An I2C-based driver for Invensense gyroscopes. More...

Go to the source code of this file.

Functions

static int set_int_enable (unsigned char enable)
 Enable/disable data ready interrupt.
int mpu_reg_dump (void)
 Register dump for testing.
int mpu_read_reg (unsigned char reg, unsigned char *data)
 Read from a single register.
int mpu_init (struct int_param_s *int_param)
 Initialize hardware.
int mpu_lp_accel_mode (unsigned short rate)
 Enter low-power accel-only mode.
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_temperature (long *data, unsigned long *timestamp)
 Read temperature data directly from the registers.
int mpu_read_6500_accel_bias (long *accel_bias)
 Read biases to the accel bias 6500 registers.
int mpu_read_6050_accel_bias (long *accel_bias)
 Read biases to the accel bias 6050 registers.
int mpu_set_gyro_bias_reg (long *gyro_bias)
 Push biases to the gyro bias 6500/6050 registers.
int mpu_set_accel_bias_6050_reg (const long *accel_bias)
 Push biases to the accel bias 6050 registers.
int mpu_set_accel_bias_6500_reg (const long *accel_bias)
 Push biases to the accel bias 6500 registers.
int mpu_reset_fifo (void)
 Reset FIFO read/write pointers.
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_lpf (unsigned short *lpf)
 Get the current DLPF setting.
int mpu_set_lpf (unsigned short lpf)
 Set digital low pass filter.
int mpu_get_sample_rate (unsigned short *rate)
 Get sampling rate.
int mpu_set_sample_rate (unsigned short rate)
 Set sampling rate.
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.
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_fifo_config (unsigned char *sensors)
 Get current FIFO configuration.
int mpu_configure_fifo (unsigned char sensors)
 Select which sensors are pushed to FIFO.
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.
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.
int mpu_read_fifo_stream (unsigned short length, unsigned char *data, unsigned char *more)
 Get one unparsed packet from the FIFO.
int mpu_set_bypass (unsigned char bypass_on)
 Set device to bypass mode.
int mpu_set_int_level (unsigned char active_low)
 Set interrupt level.
int mpu_set_int_latched (unsigned char enable)
 Enable latched interrupts.
int mpu_run_6500_self_test (long *gyro, long *accel, unsigned char debug)
 Trigger gyro/accel/compass self-test for MPU6500/MPU9250 On success/error, the self-test returns a mask representing the sensor(s) that failed.
int mpu_write_mem (unsigned short mem_addr, unsigned short length, unsigned char *data)
 Write to the DMP memory.
int mpu_read_mem (unsigned short mem_addr, unsigned short length, unsigned char *data)
 Read from the DMP memory.
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_set_dmp_state (unsigned char enable)
 Enable/disable DMP support.
int mpu_get_dmp_state (unsigned char *enabled)
 Get DMP state.
int mpu_get_compass_reg (short *data, unsigned long *timestamp)
 Read raw compass data.
int mpu_get_compass_fsr (unsigned short *fsr)
 Get the compass full-scale range.
int mpu_lp_motion_interrupt (unsigned short thresh, unsigned char time, unsigned short lpa_freq)
 Enters LP accel motion interrupt mode.

Detailed Description

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)

Definition in file inv_mpu.c.