Initial implementation of iAcceleration

Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
This commit is contained in:
Serban Waltter
2018-07-26 18:06:33 +03:00
parent d431d1458e
commit a411723e5c
48 changed files with 512 additions and 35 deletions

View File

@ -108,6 +108,14 @@ std::vector<float> LIS2DS12::getAccelerometer()
return std::vector<float>(v, v+3);
}
std::vector<float> LIS2DS12::getAcceleration()
{
std::vector<float> v(3);
lis2ds12_get_accelerometer(m_lis2ds12, &v[0], &v[1], &v[2]);
return v;
}
float LIS2DS12::getTemperature(bool fahrenheit)
{
float temperature = lis2ds12_get_temperature(m_lis2ds12);

View File

@ -31,6 +31,8 @@
#include <mraa/gpio.hpp>
#include "lis2ds12.h"
#include <interfaces/iAcceleration.hpp>
namespace upm {
/**
@ -70,7 +72,7 @@ namespace upm {
* @snippet lis2ds12.cxx Interesting
*/
class LIS2DS12 {
class LIS2DS12: virtual public iAcceleration {
public:
/**
@ -135,6 +137,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 the current measured temperature. Note, this is not
* ambient temperature. update() must have been called prior to