Modified MAG3110 with individual X, Y, and Z sampling
Fork of MAG3110 by
Revision 5:b81ec73cd601, committed 2014-02-02
- Comitter:
- oliverfang
- Date:
- Sun Feb 02 22:06:36 2014 +0000
- Parent:
- 4:cf40601402b7
- Commit message:
- Accelerometer and Magnetometer data collection
Changed in this revision
MAG3110.cpp | Show annotated file Show diff for this revision Revisions of this file |
MAG3110.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r cf40601402b7 -r b81ec73cd601 MAG3110.cpp --- a/MAG3110.cpp Fri May 24 20:16:24 2013 +0000 +++ b/MAG3110.cpp Sun Feb 02 22:06:36 2014 +0000 @@ -71,6 +71,21 @@ return (atan2((double)(yVal - _avgY),(double)(xVal - _avgX)))*180/PI; } +int MAG3110::getXVal() +{ + return readVal(MAG_OUT_X_MSB); +} + +int MAG3110::getYVal() +{ + return readVal(MAG_OUT_Y_MSB); +} + +int MAG3110::getZVal() +{ + return readVal(MAG_OUT_Z_MSB); +} + void MAG3110::getValues(int *xVal, int *yVal, int *zVal) { *xVal = readVal(MAG_OUT_X_MSB); @@ -78,7 +93,6 @@ *zVal = readVal(MAG_OUT_Z_MSB); } - void MAG3110::setCalibration(int minX, int maxX, int minY, int maxY ) { _avgX=(maxX+minX)/2;
diff -r cf40601402b7 -r b81ec73cd601 MAG3110.h --- a/MAG3110.h Fri May 24 20:16:24 2013 +0000 +++ b/MAG3110.h Sun Feb 02 22:06:36 2014 +0000 @@ -123,6 +123,22 @@ * @param yVal Pointer to Y value * @param zVal Pointer to Z value */ + + int getXVal(); + /** + * Reads and returns X value using readVal + */ + + int getYVal(); + /** + * Reads and returns Y value using readVal + */ + + int getZVal(); + /** + * Reads and returns Z value using readVal + */ + void getValues(int *xVal, int *yVal, int *zVal); /** * Set the calibration parameters if required.