Added iGyroscope interface

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-10-02 14:06:17 +03:00
committed by Mihai Tudor Panu
parent 34bb12933d
commit aa966946d5
39 changed files with 222 additions and 47 deletions

View File

@ -5,5 +5,6 @@ upm_mixed_module_init (NAME bmg160
CPP_HDR bmg160.hpp
CPP_SRC bmg160.cxx
FTI_SRC bmg160_fti.c
IFACE_HDR iGyroscope.hpp
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -108,6 +108,7 @@ void BMG160::getGyroscope(float *x, float *y, float *z)
std::vector<float> BMG160::getGyroscope()
{
update();
float v[3];
getGyroscope(&v[0], &v[1], &v[2]);

View File

@ -31,6 +31,8 @@
#include <mraa/gpio.hpp>
#include "bmg160.h"
#include <interfaces/iGyroscope.hpp>
namespace upm {
/**
@ -71,7 +73,7 @@ namespace upm {
* @snippet bmg160.cxx Interesting
*/
class BMG160 {
class BMG160: virtual public iGyroscope {
public:
/**
* BMG160 constructor.

View File

@ -1,26 +1,22 @@
#ifdef SWIGPYTHON
%module (package="upm") a110x
#endif
%import "interfaces/interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "../upm_javastdvector.i"
%ignore installISR (BMG160_INTERRUPT_PINS_T , int mraa::Edge , void *, void *);
%ignore getGyroscope(float *, float *, float *);
%typemap(javaimports) SWIGTYPE %{
import upm_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
%typemap(javaout) SWIGTYPE {
return new $&javaclassname($jnicall, true);
}
%typemap(javaout) std::vector<float> {
return (AbstractList<Float>)(new $&javaclassname($jnicall, true));
}
%typemap(jstype) std::vector<float> "AbstractList<Float>"
%template(floatVector) std::vector<float>;
%ignore installISR (BMG160_INTERRUPT_PINS_T , int mraa::Edge , void *, void *);
%ignore getGyroscope(float *, float *, float *);
%define INTERRUPT BMG160_INTERRUPT_PINS_T
%enddef