test
Fork of HMC5883L by
Diff: HMC5883L.h
- Revision:
- 5:c9ce1eeaf001
- Parent:
- 3:14d274e0f9de
diff -r bc4e1201e092 -r c9ce1eeaf001 HMC5883L.h --- a/HMC5883L.h Tue Nov 06 17:35:51 2012 +0000 +++ b/HMC5883L.h Tue Dec 10 10:58:28 2013 +0000 @@ -1,6 +1,6 @@ /* * @file HMC5883L.h - * @author Tyler Weaver + * @author Oskar Lopez de Gamboa * * @section LICENSE * @@ -22,11 +22,12 @@ * @section DESCRIPTION * * HMC5883L 3-Axis Digital Compas IC - * For use with the Sparkfun 9 Degrees of Freedom - Sensor Stick + * The library done by Tyler Weaver with: * - * Datasheet: + * *Corrected the XZY order instead of the previous XYZ to match the datasheet. + * *Added Declination compensation by a define + * * - * http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Magneto/HMC5883L-FDS.pdf */ #ifndef HMC5883L_H @@ -83,6 +84,17 @@ #define RAD_TO_DEG (180.0/M_PI) #define DEG_TO_RAD (M_PI/180.0) +// Once you have your heading, you must then add your 'Declination Angle', +// which is the 'Error' of the magnetic field in your location. +// Find yours here: http://www.magnetic-declination.com/ +// Mine is: -1° 13' WEST which is -1.2167 Degrees, or (which we need) +// 0,021234839232597676519238237683278 radians, I will use 0.02123 +// If you cannot find your Declination, put 0, your compass will be slightly off. + +#define DECLINATION_ANGLE -0.02123 +//#define DECLINATION_ANGLE 0 + + /** * The HMC5883L 3-Axis Digital Compass IC */ @@ -193,8 +205,9 @@ /** * Function for retriaval of the raw data + * Caution!! the HMC5883L gives you the data in XZY order * - * @param output buffer that is atleast 3 in length + * @param output buffer that is at least 3 in length */ void getXYZ(int16_t raw[3]); @@ -213,7 +226,7 @@ * Compass must be held flat and away from an magnetic field generating * devices such as cell phones and speakers. * - * TODO: declenation angle compensation + * * * @returns heading in radians */ @@ -225,7 +238,7 @@ * Compass must be held flat and away from an magnetic field generating * devices such as cell phones and speakers. * - * TODO: declenation angle compensation + * * * @returns heading in degrees */