Core2 for AWS IoT EduKit BSP 1.5.1
Functions
mpu6886.c File Reference
#include "freertos/FreeRTOS.h"
#include "i2c_device.h"
#include "mpu6886.h"

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 *gx, float *gy, float *gz)
 Retrieves the gyroscope measurements from the MPU6886. More...
 
void MPU6886_GetTempData (float *t)
 Retrieves the internal temperature measurement from the MPU6886. More...
 

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.