mirror of
https://github.com/eclipse/upm.git
synced 2025-07-26 21:51:16 +03:00
Added iGyroscope interface
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
34bb12933d
commit
aa966946d5
@ -2,5 +2,5 @@ set (libname "mpu9150")
|
||||
set (libdescription "IMU Sensor Library Based On the Mpu9150")
|
||||
set (module_src ${libname}.cxx ak8975.cxx mpu60x0.cxx mpu9250.cxx)
|
||||
set (module_hpp ${libname}.hpp ak8975.hpp mpu60x0.hpp mpu9250.hpp)
|
||||
set (module_iface iAcceleration.hpp)
|
||||
set (module_iface iAcceleration.hpp iGyroscope.hpp)
|
||||
upm_module_init(mraa)
|
||||
|
@ -325,6 +325,13 @@ void MPU60X0::getGyroscope(float *x, float *y, float *z)
|
||||
*z = m_gyroZ / m_gyroScale;
|
||||
}
|
||||
|
||||
std::vector<float> MPU60X0::getGyroscope()
|
||||
{
|
||||
update();
|
||||
return std::vector<float> {m_gyroX / m_gyroScale, m_gyroY / m_gyroScale, m_gyroZ / m_gyroScale};
|
||||
}
|
||||
|
||||
|
||||
float MPU60X0::getTemperature()
|
||||
{
|
||||
// this equation is taken from the datasheet
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <mraa/gpio.hpp>
|
||||
|
||||
#include <interfaces/iAcceleration.hpp>
|
||||
#include <interfaces/iGyroscope.hpp>
|
||||
|
||||
#define MPU60X0_I2C_BUS 0
|
||||
#define MPU60X0_DEFAULT_I2C_ADDR 0x68
|
||||
@ -62,7 +63,7 @@ namespace upm {
|
||||
* @image html mpu60x0.jpg
|
||||
* @snippet mpu9150-mpu60x0.cxx Interesting
|
||||
*/
|
||||
class MPU60X0: virtual public iAcceleration {
|
||||
class MPU60X0: virtual public iAcceleration, virtual public iGyroscope {
|
||||
public:
|
||||
|
||||
// NOTE: These enums were composed from both the mpu6050 and
|
||||
@ -811,6 +812,13 @@ namespace upm {
|
||||
*/
|
||||
void getGyroscope(float *x, float *y, float *z);
|
||||
|
||||
/**
|
||||
* get the gyroscope values in degrees per second
|
||||
*
|
||||
* @return std::vector containing X, Y, Z gyroscope values
|
||||
*/
|
||||
std::vector<float> getGyroscope();
|
||||
|
||||
/**
|
||||
* get the temperature value
|
||||
*
|
||||
|
Reference in New Issue
Block a user