Update version of EALib.

Dependencies:   FATFileSystem

Fork of EALib by IONX

Embed: (wiki syntax)

« Back to documentation index

MMA7455 Class Reference

MMA7455 Class Reference

Freescale Accelerometer MMA7455. More...

#include <MMA7455.h>

Public Types

enum  Range
 

Acceleration range.

More...

Public Member Functions

 MMA7455 (PinName sda, PinName scl)
 Create an interface to the MMA7455 accelerometer.
bool calibrate ()
 Calibrate for 0g, that is, calculate offset to achieve 0g values when accelerometer is placed on flat surface.
bool getCalibrationOffsets (int32_t &xOff, int32_t &yOff, int32_t &zOff)
 Get calculated offset values.
bool setCalibrationOffsets (int32_t xOff, int32_t yOff, int32_t zOff)
 Set calibration offset values.

Detailed Description

Freescale Accelerometer MMA7455.

Definition at line 24 of file MMA7455.h.


Member Enumeration Documentation

enum Range

Acceleration range.

Definition at line 33 of file MMA7455.h.


Constructor & Destructor Documentation

MMA7455 ( PinName  sda,
PinName  scl 
)

Create an interface to the MMA7455 accelerometer.

Parameters:
sdaI2C data line pin
sclI2C clock line pin

Definition at line 71 of file MMA7455.cpp.


Member Function Documentation

bool calibrate (  )

Calibrate for 0g, that is, calculate offset to achieve 0g values when accelerometer is placed on flat surface.

Please make sure the accelerometer is placed on a flat surface before calling this function.

Returns:
true if request was successful; otherwise false

Definition at line 172 of file MMA7455.cpp.

bool getCalibrationOffsets ( int32_t &  xOff,
int32_t &  yOff,
int32_t &  zOff 
)

Get calculated offset values.

Offsets will be calculated by the calibrate() method.

Use these values and put them in persistent storage to avoid having to calibrate the accelerometer after a reset/power cycle.

Parameters:
xOffx offset is written to this argument
yOffy offset is written to this argument
zOffz offset is written to this argument
Returns:
true if request was successful; otherwise false

Definition at line 248 of file MMA7455.cpp.

bool setCalibrationOffsets ( int32_t  xOff,
int32_t  yOff,
int32_t  zOff 
)

Set calibration offset values.

These values should normally at one point in time have been retrieved by calling the getCalibrationOffsets method.

Parameters:
xOffx offset
yOffy offset
zOffz offset
Returns:
true if request was successful; otherwise false

Definition at line 240 of file MMA7455.cpp.