mirror of
https://github.com/eclipse/upm.git
synced 2025-07-26 21:51:16 +03:00
Initial implementation of iAcceleration
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
90524273ec
commit
f992876461
@ -301,6 +301,18 @@ void MPU60X0::getAccelerometer(float *x, float *y, float *z)
|
||||
*z = m_accelZ / m_accelScale;
|
||||
}
|
||||
|
||||
std::vector<float> MPU60X0::getAcceleration()
|
||||
{
|
||||
update();
|
||||
|
||||
std::vector<float> v(3);
|
||||
v[0] = m_accelX / m_accelScale;
|
||||
v[1] = m_accelY / m_accelScale;
|
||||
v[2] = m_accelZ / m_accelScale;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
void MPU60X0::getGyroscope(float *x, float *y, float *z)
|
||||
{
|
||||
if (x)
|
||||
|
@ -24,11 +24,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <mraa/common.hpp>
|
||||
#include <mraa/i2c.hpp>
|
||||
|
||||
#include <mraa/gpio.hpp>
|
||||
|
||||
#include <interfaces/iAcceleration.hpp>
|
||||
|
||||
#define MPU60X0_I2C_BUS 0
|
||||
#define MPU60X0_DEFAULT_I2C_ADDR 0x68
|
||||
|
||||
@ -59,7 +62,7 @@ namespace upm {
|
||||
* @image html mpu60x0.jpg
|
||||
* @snippet mpu9150-mpu60x0.cxx Interesting
|
||||
*/
|
||||
class MPU60X0 {
|
||||
class MPU60X0: virtual public iAcceleration {
|
||||
public:
|
||||
|
||||
// NOTE: These enums were composed from both the mpu6050 and
|
||||
@ -791,6 +794,13 @@ namespace upm {
|
||||
*/
|
||||
void getAccelerometer(float *x, float *y, float *z);
|
||||
|
||||
/**
|
||||
* get acceleration values
|
||||
*
|
||||
* @return stl vector of size 3 representing the 3 axis
|
||||
*/
|
||||
virtual std::vector<float> getAcceleration();
|
||||
|
||||
/**
|
||||
* get the gyroscope values
|
||||
*
|
||||
|
Reference in New Issue
Block a user