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.
Dependencies: ConfigFile SDFileSystem mbed
Fork of LAURUS_program by
Diff: HMC5883L/HMC5883L.cpp
- Revision:
- 1:6cd6d2760856
- Parent:
- 0:bc6f14fc60c7
diff -r bc6f14fc60c7 -r 6cd6d2760856 HMC5883L/HMC5883L.cpp
--- a/HMC5883L/HMC5883L.cpp Fri May 15 17:24:32 2015 +0000
+++ b/HMC5883L/HMC5883L.cpp Sun May 24 17:32:47 2015 +0000
@@ -1,9 +1,7 @@
#include "mbed.h"
#include "HMC5883L.h"
-HMC5883L::HMC5883L(I2C* i2c) {
- this->i2c = i2c;
-}
+HMC5883L::HMC5883L(I2C* p_i2c): i2c(p_i2c) {}
HMC5883L::~HMC5883L() {
i2c = NULL;
@@ -30,9 +28,15 @@
data.reg[i*2+1] = temp;
}
+ // 軸を加速度センサーとあわせる
int16_t temp = data.value[1];
data.value[1] = data.value[2];
data.value[2] = temp;
+ temp = data.value[1];
+ data.value[1] = -data.value[0];
+ data.value[0] = temp;
+
+
return 1;
}
\ No newline at end of file
