API for the MMA7455 Accelerometer.
More...
- ID: mma7455
- Name: MMA7455 Accelerometer Sensor
- Category: accelerometer
- Manufacturer: generic
- Connection: i2c
This module defines the MMA7455 interface for libmma7455
short x, y, z;
while (!doWork) {
sensor->readData(&x, &y, &z);
std::cout << "Accelerometer X(" << x << ") Y(" << y << ") Z(" << z << ")" << std::endl;
usleep (100000);
}
|
| 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) |
|
MMA7455 |
( |
int |
bus = 0 , |
|
|
int |
devAddr = 0x1D |
|
) |
| |
Instantiates an MMA7455 object
- Parameters
-
bus | Number of the used bus |
devAddr | Address of the used I2C device |
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
mraa::Result readData |
( |
short * |
ptrX, |
|
|
short * |
ptrY, |
|
|
short * |
ptrZ |
|
) |
| |
Reads X-axis, Y-axis, and Z-axis acceleration data
- Parameters
-
ptrX | X-axis |
ptrY | Y-axis |
ptrZ | Z-axis |
- Returns
- 0 (MRAA_SUCCESS) if successful; non-zero otherwise
int i2cReadReg |
( |
unsigned char |
reg, |
|
|
uint8_t * |
buffer, |
|
|
int |
len |
|
) |
| |
Internal function for reading I2C data
- Parameters
-
reg | Register address |
buffer | Register data buffer |
len | Buffer size |
mraa::Result i2cWriteReg |
( |
unsigned char |
reg, |
|
|
uint8_t * |
buffer, |
|
|
int |
len |
|
) |
| |
Internal function for writing I2C data
- Parameters
-
reg | Register address |
buffer | Register data buffer |
len | Buffer size |
The documentation for this class was generated from the following files:
- /iotdk/jenkins/workspace/upm-doc-stable/src/mma7455/mma7455.h
- /iotdk/jenkins/workspace/upm-doc-stable/src/mma7455/mma7455.cxx