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

C++ API for MMA7455 chip (accelerometer) More...

Detailed Description

This file defines the MMA7455 C++ interface for libmma7455

sensor = new upm::MMA7455(0, ADDR);
short x, y, z;
while (!doWork) {
sensor->readData(&x, &y, &z);
std::cout << "Accelerometer X(" << x << ") Y(" << y << ") Z(" << z << ")" << std::endl;
usleep (100000);
}

Public Member Functions

 MMA7455 (int bus, int devAddr)
 
 ~MMA7455 ()
 
std::string name ()
 
mraa_result_t calibrate ()
 
mraa_result_t readData (short *ptrX, short *ptrY, short *ptrZ)
 
int ic2ReadReg (unsigned char reg, unsigned char *buf, unsigned char size)
 
mraa_result_t ic2WriteReg (unsigned char reg, unsigned char *buf, unsigned char size)
 

Constructor & Destructor Documentation

MMA7455 ( int  bus,
int  devAddr 
)

Instanciates a MMA7455 object

Parameters
busnumber of used bus
devAddraddres of used i2c device

Here is the call graph for this function:

~MMA7455 ( )

MMA7455 object destructor, basicaly it close i2c connection.

Member Function Documentation

std::string name ( )
inline

Return name of the component

mraa_result_t calibrate ( )

Calibrate the sensor

Here is the call graph for this function:

Here is the caller graph for this function:

mraa_result_t readData ( short *  ptrX,
short *  ptrY,
short *  ptrZ 
)

Read X, Y and Z acceleration data

Parameters
ptrXX axis
ptrYY axis
ptrZZ axis

Here is the call graph for this function:

Here is the caller graph for this function:

int ic2ReadReg ( unsigned char  reg,
unsigned char *  buf,
unsigned char  size 
)
Parameters
regregister address
bufregister data buffer
sizebuffer size

Here is the caller graph for this function:

mraa_result_t ic2WriteReg ( unsigned char  reg,
unsigned char *  buf,
unsigned char  size 
)
Parameters
regregister address
bufregister data buffer
sizebuffer size

Here is the caller graph for this function:


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