mirror of
https://github.com/eclipse/upm.git
synced 2025-07-27 06:01: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
@ -328,6 +328,19 @@ MMA8X5X::getZ(int bSampleData)
|
||||
return s_data->z;
|
||||
}
|
||||
|
||||
std::vector<float>
|
||||
MMA8X5X::getAcceleration()
|
||||
{
|
||||
sampleData();
|
||||
|
||||
std::vector<float> v(3);
|
||||
v[0] = s_data->x;
|
||||
v[1] = s_data->y;
|
||||
v[2] = s_data->z;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
int
|
||||
MMA8X5X::getData(mma8x5x_data_t* data, int bSampleData)
|
||||
{
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <interfaces/iAcceleration.hpp>
|
||||
|
||||
/* Supported devices by this driver */
|
||||
#define MMA8X5X_DEVICE_ID_MMA8652 0x4a
|
||||
#define MMA8X5X_DEVICE_ID_MMA8653 0x5a
|
||||
@ -341,7 +343,7 @@ typedef struct {
|
||||
*
|
||||
* @snippet mma8x5x.cxx Interesting
|
||||
*/
|
||||
class MMA8X5X {
|
||||
class MMA8X5X: virtual public iAcceleration {
|
||||
public:
|
||||
/**
|
||||
*
|
||||
@ -448,6 +450,13 @@ class MMA8X5X {
|
||||
*/
|
||||
int16_t getZ(int bSampleData = 0);
|
||||
|
||||
/**
|
||||
* get acceleration values
|
||||
*
|
||||
* @return stl vector of size 3 representing the 3 axis
|
||||
*/
|
||||
virtual std::vector<float> getAcceleration();
|
||||
|
||||
/**
|
||||
* Get sensor values
|
||||
*
|
||||
|
Reference in New Issue
Block a user