upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

API for the MMA7455 Accelerometer. More...

Detailed Description

This module defines the MMA7455 interface for libmma7455

mma7455.jpg
upm::MMA7455 sensor(0, ADDR);
short x, y, z;
while (!doWork) {
sensor.readData(&x, &y, &z);
std::cout << "Accelerometer X(" << x << ") Y(" << y << ") Z(" << z << ")" << std::endl;
upm_delay_us(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)
 
std::vector< short > readData ()
 
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

Here is the call graph for this function:

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:

std::vector< short > readData ( )

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

Returns
std::vector containing X, Y, Z acceleration data

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: