summaryrefslogtreecommitdiff
path: root/src/app/i2cdetect
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-10-21 16:39:32 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-10-21 16:39:32 +0200
commit386be4780922d8c6107163d044c557c59178200c (patch)
treeeb3386d5cb15fbeaa1d4163d582c5db41ae337fa /src/app/i2cdetect
parent7fe932417c4e36f89e4ce250788afa3f3f115443 (diff)
Add basic MPU9250 driver
Diffstat (limited to 'src/app/i2cdetect')
-rw-r--r--src/app/i2cdetect/main.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/app/i2cdetect/main.cc b/src/app/i2cdetect/main.cc
index e74ce5b..e235369 100644
--- a/src/app/i2cdetect/main.cc
+++ b/src/app/i2cdetect/main.cc
@@ -28,6 +28,9 @@
#ifdef DRIVER_HDC1080
#include "driver/hdc1080.h"
#endif
+#ifdef DRIVER_MPU9250
+#include "driver/mpu9250.h"
+#endif
#ifdef DRIVER_MMSIMPLE
#include "driver/mmsimple.h"
#endif
@@ -88,6 +91,20 @@ void loop(void)
kout << "HDC1080 temperature " << hdc1080.getTemp() << " degC" << endl;
kout << "HDC1080 humidity " << hdc1080.getRH() << " %H" << endl;
#endif
+#ifdef DRIVER_MPU9250
+ int mx, my, mz;
+ kout << "Temperature: " << mpu9250.getTemperature() << endl;
+ kout << "Accel X " << mpu9250.getAccelX() << endl;
+ kout << "Accel Y " << mpu9250.getAccelX() << endl;
+ kout << "Accel Z " << mpu9250.getAccelX() << endl;
+ kout << "Gyro X " << mpu9250.getGyroX() << endl;
+ kout << "Gyro Y " << mpu9250.getGyroX() << endl;
+ kout << "Gyro Z " << mpu9250.getGyroX() << endl;
+ mpu9250.getMagnet(&mx, &my, &mz);
+ kout << "Magnet X " << mx << endl;
+ kout << "Magnet Y " << mx << endl;
+ kout << "Magnet Z " << mx << endl;
+#endif
#ifdef DRIVER_MAX44009
kout.printf_float(max44009.getLux());
kout << endl;
@@ -131,6 +148,9 @@ int main(void)
kout << "[!] invalid HDC1080 manufacturer ID: " << hex << hdc1080.getManufacturerID() << endl;
}
#endif
+#ifdef DRIVER_MPU9250
+ mpu9250.init();
+#endif
for (unsigned char i = 0; i < sizeof(i2c_status)/sizeof(unsigned int); i++) {
i2c_status[i] = 0;