upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions
MMA7455 Class Reference

API for the MMA7455 Accelerometer. More...

Detailed Description

This module defines the MMA7455 interface for libmma7455

mma7455.jpg
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=0, int devAddr=0x1D)
 
std::string name ()
 
mraa::Result calibrate ()
 
mraa::Result readData (short *ptrX, short *ptrY, short *ptrZ)
 
int i2cReadReg (unsigned char reg, uint8_t *buffer, int len)
 
mraa::Result i2cWriteReg (unsigned char reg, uint8_t *buffer, int len)
 

Constructor & Destructor Documentation

MMA7455 ( int  bus = 0,
int  devAddr = 0x1D 
)

Instantiates an MMA7455 object

Parameters
busNumber of the used bus
devAddrAddress of the used I2C device

Here is the call graph for this function:

Member Function Documentation

std::string name ( )
inline

Returns the name of the component

Returns
Name of the component
mraa::Result calibrate ( void  )

Calibrates the sensor

Returns
0 (MRAA_SUCCESS) if successful; non-zero otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

mraa::Result readData ( short *  ptrX,
short *  ptrY,
short *  ptrZ 
)

Reads X-axis, Y-axis, and Z-axis acceleration data

Parameters
ptrXX-axis
ptrYY-axis
ptrZZ-axis
Returns
0 (MRAA_SUCCESS) if successful; non-zero otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

int i2cReadReg ( unsigned char  reg,
uint8_t *  buffer,
int  len 
)

Internal function for reading I2C data

Parameters
regRegister address
bufferRegister data buffer
lenBuffer size

Here is the caller graph for this function:

mraa::Result i2cWriteReg ( unsigned char  reg,
uint8_t *  buffer,
int  len 
)

Internal function for writing I2C data

Parameters
regRegister address
bufferRegister data buffer
lenBuffer size

Here is the caller graph for this function:


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