A basic library for the MMA8652 accelerometer, provides data in either floating point G's or as a signed 16 bit integer.
Dependents: Hello_MMA8652 Multi-Sensor Buddi_Blueband Freescale_Multi-Sensor_Shield ... more
MMA8652 Class Reference
MMA8652 Xtrinsic accelerometer on I2C. More...
#include <MMA8652.h>
Public Member Functions | |
MMA8652 (PinName sda, PinName scl) | |
MMA8652 constructor. | |
~MMA8652 () | |
MMA8652 destructor. | |
void | ReadXYZ (float *a) |
Get XYZ axis acceleration in floating point G's. | |
void | ReadXYZraw (int16_t *d) |
Get XYZ axis acceleration, signed 16 bit values. | |
char | getWhoAmI (void) |
Get the value of the WHO_AM_I register. |
Detailed Description
MMA8652 Xtrinsic accelerometer on I2C.
Definition at line 39 of file MMA8652.h.
Constructor & Destructor Documentation
MMA8652 | ( | PinName | sda, |
PinName | scl | ||
) |
~MMA8652 | ( | ) |
MMA8652 destructor.
Definition at line 28 of file MMA8652.cpp.
Member Function Documentation
char getWhoAmI | ( | void | ) |
Get the value of the WHO_AM_I register.
- Returns:
- DEVICE_ID value == 0x3A
Definition at line 74 of file MMA8652.cpp.
void ReadXYZ | ( | float * | a ) |
Get XYZ axis acceleration in floating point G's.
- Parameters:
-
res array where acceleration data will be stored
Definition at line 81 of file MMA8652.cpp.
void ReadXYZraw | ( | int16_t * | d ) |
Get XYZ axis acceleration, signed 16 bit values.
- Parameters:
-
res array where acceleration data will be stored
Definition at line 98 of file MMA8652.cpp.
Generated on Fri Jul 15 2022 18:29:58 by 1.7.2