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

@ -629,6 +629,13 @@ std::vector<float> LSM9DS0::getAccelerometer()
return v;
}
std::vector<float> LSM9DS0::getAcceleration()
{
std::vector<float> v(3);
getAccelerometer(&v[0], &v[1], &v[2]);
return v;
}
std::vector<float> LSM9DS0::getGyroscope()
{
std::vector<float> v(3);

View File

@ -30,6 +30,8 @@
#include <mraa/gpio.hpp>
#include <interfaces/iAcceleration.hpp>
#define LSM9DS0_I2C_BUS 1
#define LSM9DS0_DEFAULT_XM_ADDR 0x1d
#define LSM9DS0_DEFAULT_GYRO_ADDR 0x6b
@ -77,7 +79,7 @@ namespace upm {
* @snippet lsm9ds0.cxx Interesting
*/
class LSM9DS0 {
class LSM9DS0: virtual public iAcceleration {
public:
// NOTE: reserved registers must not be written into or permanent
@ -1274,6 +1276,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();
/**
* get the gyroscope values in degrees per second
*