API for the MMA7455 Accelerometer.
More...
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;
upm_delay_us(100000);
}
|
| 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) |
|
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
std::vector< short > readData |
( |
| ) |
|
Reads X-axis, Y-axis, and Z-axis acceleration data
- Returns
- std::vector containing X, Y, Z acceleration data
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: