Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: HMC5883L.cpp
- Revision:
- 5:ea1b30a71280
- Parent:
- 4:bc4e1201e092
- Child:
- 6:5c0cebb61b0f
--- a/HMC5883L.cpp Tue Nov 06 17:35:51 2012 +0000
+++ b/HMC5883L.cpp Wed Feb 06 11:53:18 2019 +0000
@@ -129,11 +129,11 @@
output[i] = int16_t(((unsigned char)data[i*2] << 8) | (unsigned char)data[i*2+1]);
}
-double HMC5883L::getHeadingXY()
+double HMC5883L::getHeadingXY(int Calib_x,int Calib_y)
{
int16_t raw_data[3];
getXYZ(raw_data);
- double heading = atan2(static_cast<double>(raw_data[1]), static_cast<double>(raw_data[0])); // heading = arctan(Y/X)
+ double heading = atan2(static_cast<double>(raw_data[1]+Calib_x), static_cast<double>(raw_data[0])+Calib_y); // heading = arctan(Y/X)
// TODO: declenation angle compensation