C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
MPU6050 Class Reference

Class that manage the MPU6050 3-axes accelerometer/gyrometer. More...

#include <mpu6050.h>

Collaboration diagram for MPU6050:
Collaboration graph

Public Member Functions

 MPU6050 (HW_I2C_Master *master, struct_ConfigMPU6050 default_config)
 Construct a new MPU6050 object.
 
uint16_t get_FIFO_count ()
 Get the FIFO count object.
 
float get_MPU_temperature ()
 Get the MPU temperature object.
 
bool is_data_ready ()
 the flag that indicates if sensors data are ready
 
struct_I2CXferResult get_measures ()
 Get the raw data, fill the internal struct_RawData, converts raw data to real measures according to offset and coversion factor.
 
void read_FIFO_all_raw_data ()
 read raw data from FIFO
 

Public Attributes

struct_MPUData data
 the set of measures from sensors
 
struct_RawData raw
 the set of raw data from sensors
 

Private Member Functions

void init_mpu ()
 initialise the MPU configuration
 
struct_I2CXferResult read_registers_all_raw_data ()
 fill the internal data with raw values from sensors
 
void calibrate ()
 start the calibration of the MPU and compute gyro and accellero offset and conversion factor
 
void convert_raw_to_measure ()
 fill the internal measures by converting the raw data
 
void read_FIFO_g_accel_raw_data ()
 read raw acceleration and gyrometer data from FIFO
 
void read_FIFO_accel_raw_data ()
 read raw acceleration data from FIFO
 

Private Attributes

HW_I2C_Mastermaster
 the I2C master that control the MPU6050 device
 
struct_ConfigMPU6050 device_config
 the MPU6050 configuration
 
float acceleration_factor {}
 the accelerator proportional factor computed according to the device configuration
 
float gyro_factor {}
 the gyrometer proportional factor computed according to the device configuration
 
float temperature_gain = 1.0 / 340.0
 the proportional factor for the temperature
 
float temperature_offset = 36.53
 the temperature offset
 
float accel_x_offset {}
 the x-acceleration offset
 
float accel_y_offset {}
 the y-acceleration offset
 
float accel_z_offset {}
 the z-acceleration offset
 
float gyro_x_offset {}
 the x-gyrometer offset
 
float gyro_y_offset {}
 the y-gyrometer offset
 
float gyro_z_offset {}
 the z-gyrometer offset
 

Detailed Description

Class that manage the MPU6050 3-axes accelerometer/gyrometer.

Note
I2C signals are very sensitive. May not work properly when wiring is not clean

Constructor & Destructor Documentation

◆ MPU6050()

MPU6050::MPU6050 ( HW_I2C_Master * master,
struct_ConfigMPU6050 default_config )

Construct a new MPU6050 object.

Parameters
masterThe associated I2C bus master
default_configthe default config according to struct_ConfigMPU6050
Here is the call graph for this function:

Member Function Documentation

◆ get_FIFO_count()

uint16_t MPU6050::get_FIFO_count ( )

Get the FIFO count object.

Returns
uint16_t

◆ get_measures()

struct_I2CXferResult MPU6050::get_measures ( )

Get the raw data, fill the internal struct_RawData, converts raw data to real measures according to offset and coversion factor.

Returns
struct_MPUData
Here is the call graph for this function:

◆ get_MPU_temperature()

float MPU6050::get_MPU_temperature ( )

Get the MPU temperature object.

Returns
float

◆ is_data_ready()

bool MPU6050::is_data_ready ( )

the flag that indicates if sensors data are ready

Returns
true
false
Here is the caller graph for this function:

◆ read_FIFO_all_raw_data()

void MPU6050::read_FIFO_all_raw_data ( )

read raw data from FIFO

Bug
//FIXME : check FIFO data reading.... seems not working well

◆ read_registers_all_raw_data()

struct_I2CXferResult MPU6050::read_registers_all_raw_data ( )
private

fill the internal data with raw values from sensors

Returns
struct_I2CXferResult The result of the i2c reading
Here is the caller graph for this function:

The documentation for this class was generated from the following files: