Core2 for AWS IoT EduKit BSP 1.5.1
Macros | Enumerations | Functions
mpu6886.h File Reference

Functions for the MPU6886 inertial measurement unit (IMU). More...

#include "stdint.h"

Go to the source code of this file.

Macros

#define MPU6886_ADDRESS   0x68
 
#define MPU6886_WHOAMI   0x75
 
#define MPU6886_ACCEL_INTEL_CTRL   0x69
 
#define MPU6886_SMPLRT_DIV   0x19
 
#define MPU6886_INT_PIN_CFG   0x37
 
#define MPU6886_INT_ENABLE   0x38
 
#define MPU6886_ACCEL_XOUT_H   0x3B
 
#define MPU6886_ACCEL_XOUT_L   0x3C
 
#define MPU6886_ACCEL_YOUT_H   0x3D
 
#define MPU6886_ACCEL_YOUT_L   0x3E
 
#define MPU6886_ACCEL_ZOUT_H   0x3F
 
#define MPU6886_ACCEL_ZOUT_L   0x40
 
#define MPU6886_TEMP_OUT_H   0x41
 
#define MPU6886_TEMP_OUT_L   0x42
 
#define MPU6886_GYRO_XOUT_H   0x43
 
#define MPU6886_GYRO_XOUT_L   0x44
 
#define MPU6886_GYRO_YOUT_H   0x45
 
#define MPU6886_GYRO_YOUT_L   0x46
 
#define MPU6886_GYRO_ZOUT_H   0x47
 
#define MPU6886_GYRO_ZOUT_L   0x48
 
#define MPU6886_USER_CTRL   0x6A
 
#define MPU6886_PWR_MGMT_1   0x6B
 
#define MPU6886_PWR_MGMT_2   0x6C
 
#define MPU6886_CONFIG   0x1A
 
#define MPU6886_GYRO_CONFIG   0x1B
 
#define MPU6886_ACCEL_CONFIG   0x1C
 
#define MPU6886_ACCEL_CONFIG2   0x1D
 
#define MPU6886_FIFO_EN   0x23
 

Enumerations

enum  acc_scale_t { MPU6886_AFS_2G = 0 , MPU6886_AFS_4G , MPU6886_AFS_8G , MPU6886_AFS_16G }
 List of possible accelerometer scalars in Gs. More...
 
enum  gyro_scale_t { MPU6886_GFS_250DPS = 0 , MPU6886_GFS_500DPS , MPU6886_GFS_1000DPS , MPU6886_GFS_2000DPS }
 List of possible gyroscope scalars in degrees per second. More...
 

Functions

int MPU6886_Init (void)
 Initializes the MPU6886 over I2C. More...
 
void MPU6886_GetAccelAdc (int16_t *ax, int16_t *ay, int16_t *az)
 Retrieves the accelerometer measurements from the 16-bit ADC on the MPU6886. More...
 
void MPU6886_GetGyroAdc (int16_t *gx, int16_t *gy, int16_t *gz)
 Retrieves the gyroscope measurements from the 16-bit ADC on the MPU6886. More...
 
void MPU6886_GetTempAdc (int16_t *t)
 Retrieves the internal temperature measurement from the 16-bit ADC on the MPU6886. More...
 
float MPU6886_GetGyroRes (gyro_scale_t scale)
 Retrieves the resolution of the gyroscope measurements on the MPU6886. More...
 
float MPU6886_GetAccRes (acc_scale_t scale)
 Retrieves the resolution of the accelerometer measurements on the MPU6886. More...
 
void MPU6886_SetGyroFSR (gyro_scale_t scale)
 Sets the full-scale range of the gyroscope on the MPU6886. More...
 
void MPU6886_SetAccelFSR (acc_scale_t scale)
 Sets the full-scale range of the accelerometer on the MPU6886. More...
 
void MPU6886_GetAccelData (float *ax, float *ay, float *az)
 Retrieves the accelerometer measurements from the MPU6886. More...
 
void MPU6886_GetGyroData (float *roll, float *yaw, float *pitch)
 Retrieves the gyroscope measurements from the MPU6886. More...
 
void MPU6886_GetTempData (float *t)
 Retrieves the internal temperature measurement from the MPU6886. More...
 

Detailed Description

Functions for the MPU6886 inertial measurement unit (IMU).

Macro Definition Documentation

◆ MPU6886_ADDRESS

#define MPU6886_ADDRESS   0x68

◆ MPU6886_WHOAMI

#define MPU6886_WHOAMI   0x75

◆ MPU6886_ACCEL_INTEL_CTRL

#define MPU6886_ACCEL_INTEL_CTRL   0x69

◆ MPU6886_SMPLRT_DIV

#define MPU6886_SMPLRT_DIV   0x19

◆ MPU6886_INT_PIN_CFG

#define MPU6886_INT_PIN_CFG   0x37

◆ MPU6886_INT_ENABLE

#define MPU6886_INT_ENABLE   0x38

◆ MPU6886_ACCEL_XOUT_H

#define MPU6886_ACCEL_XOUT_H   0x3B

◆ MPU6886_ACCEL_XOUT_L

#define MPU6886_ACCEL_XOUT_L   0x3C

◆ MPU6886_ACCEL_YOUT_H

#define MPU6886_ACCEL_YOUT_H   0x3D

◆ MPU6886_ACCEL_YOUT_L

#define MPU6886_ACCEL_YOUT_L   0x3E

◆ MPU6886_ACCEL_ZOUT_H

#define MPU6886_ACCEL_ZOUT_H   0x3F

◆ MPU6886_ACCEL_ZOUT_L

#define MPU6886_ACCEL_ZOUT_L   0x40

◆ MPU6886_TEMP_OUT_H

#define MPU6886_TEMP_OUT_H   0x41

◆ MPU6886_TEMP_OUT_L

#define MPU6886_TEMP_OUT_L   0x42

◆ MPU6886_GYRO_XOUT_H

#define MPU6886_GYRO_XOUT_H   0x43

◆ MPU6886_GYRO_XOUT_L

#define MPU6886_GYRO_XOUT_L   0x44

◆ MPU6886_GYRO_YOUT_H

#define MPU6886_GYRO_YOUT_H   0x45

◆ MPU6886_GYRO_YOUT_L

#define MPU6886_GYRO_YOUT_L   0x46

◆ MPU6886_GYRO_ZOUT_H

#define MPU6886_GYRO_ZOUT_H   0x47

◆ MPU6886_GYRO_ZOUT_L

#define MPU6886_GYRO_ZOUT_L   0x48

◆ MPU6886_USER_CTRL

#define MPU6886_USER_CTRL   0x6A

◆ MPU6886_PWR_MGMT_1

#define MPU6886_PWR_MGMT_1   0x6B

◆ MPU6886_PWR_MGMT_2

#define MPU6886_PWR_MGMT_2   0x6C

◆ MPU6886_CONFIG

#define MPU6886_CONFIG   0x1A

◆ MPU6886_GYRO_CONFIG

#define MPU6886_GYRO_CONFIG   0x1B

◆ MPU6886_ACCEL_CONFIG

#define MPU6886_ACCEL_CONFIG   0x1C

◆ MPU6886_ACCEL_CONFIG2

#define MPU6886_ACCEL_CONFIG2   0x1D

◆ MPU6886_FIFO_EN

#define MPU6886_FIFO_EN   0x23

Enumeration Type Documentation

◆ acc_scale_t

List of possible accelerometer scalars in Gs.

Enumerator
MPU6886_AFS_2G 
MPU6886_AFS_4G 
MPU6886_AFS_8G 
MPU6886_AFS_16G 

◆ gyro_scale_t

List of possible gyroscope scalars in degrees per second.

Enumerator
MPU6886_GFS_250DPS 
MPU6886_GFS_500DPS 
MPU6886_GFS_1000DPS 
MPU6886_GFS_2000DPS 

Function Documentation

◆ MPU6886_Init()

int MPU6886_Init ( void  )

Initializes the MPU6886 over I2C.

Note
The Core2ForAWS_Init() calls this function when the hardware feature is enabled.
Returns
0 if successful, -1 otherwise.

◆ MPU6886_GetAccelAdc()

void MPU6886_GetAccelAdc ( int16_t *  ax,
int16_t *  ay,
int16_t *  az 
)

Retrieves the accelerometer measurements from the 16-bit ADC on the MPU6886.

Parameters
[out]axThe 16-bit accelerometer measurement in the X direction.
[out]ayThe 16-bit accelerometer measurement in the Y direction.
[out]azThe 16-bit accelerometer measurement in the Z direction.

◆ MPU6886_GetGyroAdc()

void MPU6886_GetGyroAdc ( int16_t *  gx,
int16_t *  gy,
int16_t *  gz 
)

Retrieves the gyroscope measurements from the 16-bit ADC on the MPU6886.

Parameters
[out]gxThe 16-bit accelerometer measurement in the X direction.
[out]gyThe 16-bit accelerometer measurement in the Y direction.
[out]gzThe 16-bit accelerometer measurement in the Z direction.

◆ MPU6886_GetTempAdc()

void MPU6886_GetTempAdc ( int16_t *  t)

Retrieves the internal temperature measurement from the 16-bit ADC on the MPU6886.

Parameters
[out]tTemperature of the MPU6886 passed through the 16-bit ADC.

◆ MPU6886_GetGyroRes()

float MPU6886_GetGyroRes ( gyro_scale_t  scale)

Retrieves the resolution of the gyroscope measurements on the MPU6886.

Parameters
[in]scaleThe degrees per second scale of measurement.
Returns
The gyroscope resolution.

◆ MPU6886_GetAccRes()

float MPU6886_GetAccRes ( acc_scale_t  scale)

Retrieves the resolution of the accelerometer measurements on the MPU6886.

Parameters
[in]scaleThe G's per second scale of measurement.
Returns
The accelerometer resolution.

◆ MPU6886_SetGyroFSR()

void MPU6886_SetGyroFSR ( gyro_scale_t  scale)

Sets the full-scale range of the gyroscope on the MPU6886.

Parameters
[in]scaleThe degrees per second scale of measurement.

◆ MPU6886_SetAccelFSR()

void MPU6886_SetAccelFSR ( acc_scale_t  scale)

Sets the full-scale range of the accelerometer on the MPU6886.

Parameters
[in]scaleThe G's per second scale of measurement.

◆ MPU6886_GetAccelData()

void MPU6886_GetAccelData ( float *  ax,
float *  ay,
float *  az 
)

Retrieves the accelerometer measurements from the MPU6886.

Example:

Get the accelerometer values for the X, Y, and Z direction.

float accel_x = 0.00;
float accel_y = 0.00;
float accel_z = 0.00;
MPU6886_GetAccelData(&accel_x, &accel_y, &accel_z);
void MPU6886_GetAccelData(float *ax, float *ay, float *az)
Retrieves the accelerometer measurements from the MPU6886.
Definition: mpu6886.c:162
Parameters
[out]axThe 16-bit accelerometer measurement in the X direction.
[out]ayThe 16-bit accelerometer measurement in the Y direction.
[out]azThe 16-bit accelerometer measurement in the Z direction.

◆ MPU6886_GetGyroData()

void MPU6886_GetGyroData ( float *  roll,
float *  yaw,
float *  pitch 
)

Retrieves the gyroscope measurements from the MPU6886.

Example:

Get the gyroscope values for the Roll, Yaw, and Pitch direction.

float g_roll = 0.00;
float g_yaw = 0.00;
float g_pitch = 0.00;
MPU6886_GetGyroData(&g_roll, &g_yaw, &g_pitch);
void MPU6886_GetGyroData(float *gx, float *gy, float *gz)
Retrieves the gyroscope measurements from the MPU6886.
Definition: mpu6886.c:173
Parameters
[out]rollThe 16-bit gyroscope roll measurement.
[out]yawThe 16-bit gyroscope yaw measurement.
[out]pitchThe 16-bit gyroscope pitch measurement.

◆ MPU6886_GetTempData()

void MPU6886_GetTempData ( float *  t)

Retrieves the internal temperature measurement from the MPU6886.

Example:

Get the temperature reading of the MPU6886 temperature sensor.

float temperature;
MPU6886_GetTempData(&temperature);
void MPU6886_GetTempData(float *t)
Retrieves the internal temperature measurement from the MPU6886.
Definition: mpu6886.c:184
Parameters
[out]tTemperature of the MPU6886.