Create a project for TT_Mxx.

Embed: (wiki syntax)

« Back to documentation index

MMA8652 Class Reference

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 constructor.

Parameters:
sdaSDA pin
sdlSCL pin

Definition at line 23 of file MMA8652.cpp.

~MMA8652 (  )

MMA8652 destructor.

Definition at line 29 of file MMA8652.cpp.


Member Function Documentation

char getWhoAmI ( void   )

Get the value of the WHO_AM_I register.

Returns:
DEVICE_ID value == 0x1D

Definition at line 86 of file MMA8652.cpp.

void ReadXYZ ( float *  a )

Get XYZ axis acceleration in floating point G's.

Parameters:
resarray where acceleration data will be stored

Definition at line 93 of file MMA8652.cpp.

void ReadXYZraw ( int16_t *  d )

Get XYZ axis acceleration, signed 16 bit values.

Parameters:
resarray where acceleration data will be stored

Definition at line 110 of file MMA8652.cpp.