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: CalibrateMagneto QuaternionMath
Fork of SML2 by
GyroscopeMPU.cpp
00001 #include "GyroscopeMPU.h" 00002 #define DEBUG "MPU-Gyr" 00003 #include "Logger.h" 00004 00005 #include "Vector3.h" 00006 00007 GyroscopeMPU::GyroscopeMPU(I2C &i2c) : I2CPeripheral(i2c, 0x68 << 1 /* address */), int1(p26) 00008 { 00009 if (powerOn()) { 00010 INFO("Invensense MPU9250-Gyro found"); 00011 int1.rise(this, &GyroscopeMPU::handleInterrupt); 00012 powerOff(); 00013 } else { 00014 WARN("Invensense MPU9250-Gyro not found"); 00015 } 00016 } 00017 00018 void GyroscopeMPU::powerOff() 00019 { 00020 LOG("deep sleep"); 00021 } 00022 00023 void GyroscopeMPU::handleInterrupt(void) 00024 { 00025 delegate->sensorUpdate(read()); 00026 } 00027 00028 bool GyroscopeMPU::powerOn() 00029 { 00030 LOG("powered on"); 00031 return read_reg(117) == 0x68; // verify Chip ID 00032 } 00033 00034 void GyroscopeMPU::start() 00035 { 00036 } 00037 00038 void GyroscopeMPU::stop() 00039 { 00040 } 00041 00042 Vector3 GyroscopeMPU::read() 00043 { 00044 return Vector3(0, 0, 0); 00045 }
Generated on Wed Jul 13 2022 08:50:41 by
