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:
Serban Waltter
2018-07-26 18:06:33 +03:00
committed by Mihai Tudor Panu
parent 90524273ec
commit f992876461
48 changed files with 512 additions and 35 deletions

View File

@ -109,6 +109,14 @@ std::vector<float> LSM6DS3H::getAccelerometer()
return std::vector<float>(v, v+3);
}
std::vector<float> LSM6DS3H::getAcceleration()
{
std::vector<float> v(3);
lsm6ds3h_get_accelerometer(m_lsm6ds3h, &v[0], &v[1], &v[2]);
return v;
}
void LSM6DS3H::getGyroscope(float *x, float *y, float *z)
{
lsm6ds3h_get_gyroscope(m_lsm6ds3h, x, y, z);

View File

@ -31,6 +31,8 @@
#include <mraa/gpio.hpp>
#include "lsm6ds3h.h"
#include <interfaces/iAcceleration.hpp>
namespace upm {
/**
@ -64,7 +66,7 @@ namespace upm {
* @snippet lsm6ds3h.cxx Interesting
*/
class LSM6DS3H {
class LSM6DS3H: virtual public iAcceleration {
public:
/**
@ -129,6 +131,13 @@ namespace upm {
*/
std::vector<float> getAccelerometer();
/**
* get acceleration values
*
* @return stl vector of size 3 representing the 3 axis
*/
virtual std::vector<float> getAcceleration();
/**
* Return gyroscope data in degrees per second (DPS).
* update() must have been called prior to calling this