upm  0.1.8
Sensor/Actuator repository for libmraa (v0.4.5)
 All Data Structures Files Functions Variables Macros Pages
Public Member Functions
MPU9150 Class Reference

C++ API for MPU9150 chip (Accelrometer, Gyro and Magnometer Sensor) More...

Detailed Description

This file defines the MPU9150 C++ interface for libmpu9150

upm::MPU9150 *sensor = new upm::MPU9150(0, ADDR);
sensor->getData ();
sensor->getAcceleromter (&data);
std::cout << "*************************************************" << std::endl;
std::cout << "DEVICE ID (" << (int) sensor->getDeviceID () << ")" << std::endl;
std::cout << "*************************************************" << std::endl;
std::cout << "ACCELEROMETER :: X (" << data.axisX << ")" << " Y (" << data.axisY << ")"
<< " Z (" << data.axisZ << ")" << std::endl;
sensor->getGyro (&data);
std::cout << "GYRO :: X (" << data.axisX << ")" << " Y (" << data.axisY << ")"
<< " Z (" << data.axisZ << ")" << std::endl;
sensor->getMagnometer (&data);
std::cout << "MAGNOMETER :: X (" << data.axisX << ")" << " Y (" << data.axisY << ")"
<< " Z (" << data.axisZ << ")" << std::endl;
std::cout << "TEMPERATURE (" << sensor->getTemperature () << ")" << std::endl;
std::cout << "*************************************************" << std::endl;

Public Member Functions

 MPU9150 (int bus, int devAddr)
 
 ~MPU9150 ()
 
mraa_result_t initSensor ()
 
uint8_t getDeviceID ()
 
mraa_result_t getData ()
 
mraa_result_t getAcceleromter (Vector3D *data)
 
mraa_result_t getGyro (Vector3D *data)
 
mraa_result_t getMagnometer (Vector3D *data)
 
float getTemperature ()
 
std::string name ()
 

Constructor & Destructor Documentation

MPU9150 ( int  bus,
int  devAddr 
)

Instanciates a MPU9150 object

Parameters
busnumber of used bus
devAddraddres of used i2c device

Here is the call graph for this function:

~MPU9150 ( )

MPU9150 object destructor, basicaly it close i2c connection.

Member Function Documentation

mraa_result_t initSensor ( )

Initiate MPU9150 chips

Here is the caller graph for this function:

uint8_t getDeviceID ( )

Get identity of the device

mraa_result_t getData ( )

Get the Accelerometer, Gyro and Compass data from the chip and save it in private section.

mraa_result_t getAcceleromter ( Vector3D data)
Parameters
datastructure with 3 axis (x,y,z)
mraa_result_t getGyro ( Vector3D data)
Parameters
datastructure with 3 axis (x,y,z)
mraa_result_t getMagnometer ( Vector3D data)
Parameters
datastructure with 3 axis (x,y,z)
float getTemperature ( )

Read on die temperature from the chip

std::string name ( )
inline

Return name of the component


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