Added bindings for iAcceleration sensors

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-08-07 17:12:08 +03:00 committed by Mihai Tudor Panu
parent f992876461
commit b6e53f7da8
47 changed files with 448 additions and 84 deletions

View File

@ -76,16 +76,16 @@ add_example(APA102_Example apa102)
add_example(Apds9002_Example "apds9002;new_interfaces")
add_example(BH1750_Example "bh1750;new_interfaces")
add_example(BISS0001_Example "biss0001;new_interfaces")
add_example(BMA250E_Example bma250e)
add_example(BMC150_Example bmx055)
add_example(BMA250E_Example "bma250e;new_interfaces")
add_example(BMC150_Example "bmx055;new_interfaces")
add_example(BME280_Example "bmp280;new_interfaces")
add_example(BMG160_Example bmg160)
add_example(BMI055_Example bmx055)
add_example(BMI160_Example bmi160)
add_example(BMI055_Example "bmx055;new_interfaces")
add_example(BMI160_Example "bmi160;new_interfaces")
add_example(BMM150_Example bmm150)
add_example(BMP280_Example "bmp280;new_interfaces")
add_example(BMPX8X_Example "bmpx8x;new_interfaces")
add_example(BMX055_Example bmx055)
add_example(BMX055_Example "bmx055;new_interfaces")
add_example(BNO055_Example bno055)
add_example(Button_Example button)
add_example(Button_intr_Example button)
@ -98,7 +98,7 @@ add_example(DFRORP_Example dfrorp)
add_example(DS1307_Example ds1307)
add_example(ECEZO_Example ecezo)
add_example(ECS1030_Example ecs1030)
add_example(EHR_Example "ehr;;new_interfaces")
add_example(EHR_Example "ehr;new_interfaces")
add_example(Emg_Example emg)
add_example(ENC03R_Example enc03r)
add_example(ES08A_Example "servo;interfaces")
@ -131,7 +131,7 @@ add_example(GroveWater_Example grovewater)
add_example(GroveWFS_Example grovewfs)
add_example(Gsr_Example gsr)
add_example(GUVAS12D_Example guvas12d)
add_example(H3LIS331DL_Example h3lis331dl)
add_example(H3LIS331DL_Example "h3lis331dl;new_interfaces")
add_example(HCSR04_Example "hcsr04;new_interfaces")
add_example(HKA5_Example hka5)
add_example(HM11_Example hm11)
@ -152,13 +152,13 @@ add_example(LE910_Example uartat)
add_example(LED_Example led)
add_example(Light_Example "light;new_interfaces")
add_example(LineFinder_Example linefinder)
add_example(LIS2DS12_Example lis2ds12)
add_example(LIS2DS12_Example "lis2ds12;new_interfaces")
add_example(LoL_Example lol)
add_example(LSM303AGR_Example lsm303agr)
add_example(LSM303D_Example lsm303d)
add_example(LSM303AGR_Example "lsm303agr;new_interfaces")
add_example(LSM303D_Example "lsm303d;new_interfaces")
add_example(LSM303DLH_Example lsm303dlh)
add_example(LSM6DS3H_Example lsm6ds3h)
add_example(LSM6DSL_Example lsm6dsl)
add_example(LSM6DS3H_Example "lsm6ds3h;new_interfaces")
add_example(LSM6DSL_Example "lsm6dsl;new_interfaces")
add_example(M24LR64E_Example m24lr64e)
add_example(MAX30100_Example max30100)
add_example(MAX31855_Example max31855)
@ -172,12 +172,12 @@ add_example(MD_Example md)
add_example(MHZ16_Example mhz16)
add_example(Microphone_Example mic)
add_example(MMA7361_Example mma7361)
add_example(MMA7455_Example mma7455)
add_example(MMA7660_Example mma7660)
add_example(MMA7455_Example "mma7455;new_interfaces")
add_example(MMA7660_Example "mma7660;new_interfaces")
add_example(Moisture_Example "moisture;new_interfaces")
add_example(MPL3115A2_Example "mpl3115a2;new_interfaces")
add_example(MPR121_Example mpr121)
add_example(MPU9150_Example mpu9150)
add_example(MPU9150_Example "mpu9150;new_interfaces")
add_example(MQ2_Example gas)
add_example(MQ303A_Example mq303a)
add_example(MQ5_Example gas)

View File

@ -41,10 +41,10 @@ public class H3LIS331DL_Example {
while(true){
sensor.update();
upm_h3lis331dl.IntVector val = sensor.getRawXYZ();
AbstractList<Integer> val = sensor.getRawXYZ();
System.out.println( "Raw: X: " + val.get(0) + " Y: " + val.get(1) + " Z: " + val.get(2) );
upm_h3lis331dl.FloatVector accel = sensor.getAcceleration();
AbstractList<Float> accel = sensor.getAcceleration();
System.out.println( "Acceleration: X: " + accel.get(0) + " Y: " + accel.get(1) + " Z: " + accel.get(2) );
Thread.sleep(1000);

View File

@ -22,6 +22,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import java.util.AbstractList;
import upm_lis2ds12.*;
public class LIS2DS12_Example
@ -42,7 +44,7 @@ public class LIS2DS12_Example
// update our values from the sensor
sensor.update();
floatVector dataA = sensor.getAccelerometer();
AbstractList<Float> dataA = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + dataA.get(0)
+ " y: " + dataA.get(1)

View File

@ -22,6 +22,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import java.util.AbstractList;
import upm_lsm6ds3h.*;
public class LSM6DS3H_Example
@ -42,7 +44,7 @@ public class LSM6DS3H_Example
// update our values from the sensor
sensor.update();
floatVector data = sensor.getAccelerometer();
AbstractList<Float> data = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + data.get(0)
+ " y: " + data.get(1)

View File

@ -22,6 +22,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import java.util.AbstractList;
import upm_lsm6dsl.*;
public class LSM6DSL_Example
@ -42,7 +44,7 @@ public class LSM6DSL_Example
// update our values from the sensor
sensor.update();
floatVector data = sensor.getAccelerometer();
AbstractList<Float> data = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + data.get(0)
+ " y: " + data.get(1)

View File

@ -22,6 +22,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import java.util.AbstractList;
//NOT TESTED!!!
public class MMA7455_Example {
@ -30,7 +32,7 @@ public class MMA7455_Example {
upm_mma7455.MMA7455 sensor = new upm_mma7455.MMA7455(0);
while (true) {
upm_mma7455.ShortVector val = sensor.readData();
AbstractList<Short> val = sensor.readData();
System.out.println("Accelerometer X: " + val.get(0) + ", Y: " + val.get(1) + ", Z: " + val.get(2));
Thread.sleep(1000);

View File

@ -23,6 +23,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import java.util.AbstractList;
import upm_mma7660.MMA7660;
public class MMA7660_Example
@ -44,7 +46,7 @@ public class MMA7660_Example
while (true)
{
upm_mma7660.FloatVector acceleration = accel.getAcceleration();
AbstractList<Float> acceleration = accel.getAcceleration();
System.out.println("Acceleration: x = "
+ acceleration.get(0)
+ " y = "

View File

@ -22,6 +22,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import java.util.AbstractList;
//NOT TESTED!!!
public class MPU9150_Example {
@ -43,7 +45,7 @@ public class MPU9150_Example {
// System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
// + gyro[2]);
upm_mpu9150.FloatVector magn = sensor.getMagnetometer();
AbstractList<Float> magn = sensor.getMagnetometer();
System.out.println("Magnetometer: " + "MX: " + magn.get(0) + " MY: " + magn.get(1) + " MZ: " + magn.get(2));
Thread.sleep(1000);

View File

@ -6,6 +6,39 @@
#ifdef SWIGJAVA
%include <swiginterface.i>
%include "typemaps.i"
%{
#include <vector>
%}
%import "../../src/upm_javastdvector.i"
%typemap(javaimports) SWIGTYPE %{
import java.util.AbstractList;
import java.lang.Float;
%}
/* Using the JAVA class types outside the core package requires
getCPtr to be public, modify that here */
%typemap(javabody) SWIGTYPE %{
private long swigCPtr;
protected boolean swigCMemOwn;
public $javaclassname(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
public static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
%}
%typemap(javaout) std::vector<float> {
return (AbstractList<Float>)(new $&javaclassname($jnicall, true));
}
%typemap(jstype) std::vector<float> "AbstractList<Float>"
%template(floatVector) std::vector<float>;
%interface_impl (upm::iClock);
%interface_impl (upm::iCollision);
%interface_impl (upm::iDistance);

View File

@ -263,10 +263,21 @@ function (_get_current_dot_i_file filePrefix varDotIFile)
# Set up Java bindings
string(APPEND JAVA_TYPEMAPS "%typemap(javaimports) SWIGTYPE %{\n")
string(APPEND JAVA_TYPEMAPS "import upm_new_interfaces.*;\n%}")
if (CMAKE_VERSION VERSION_LESS "3.3" )
list (FIND module_iface "iAcceleration.hpp" _index)
if (${_index} GREATER -1)
set(JAVA_TYPEMAPS "%typemap(javaimports) SWIGTYPE %{\nimport upm_new_interfaces.*;\n\nimport java.util.AbstractList;\nimport java.lang.Float;\n%}\n")
endif()
else()
cmake_policy(SET CMP0057 NEW)
if ("iAcceleration.hpp" IN_LIST module_iface)
set(JAVA_TYPEMAPS "%typemap(javaimports) SWIGTYPE %{\nimport upm_new_interfaces.*;\n\nimport java.util.AbstractList;\nimport java.lang.Float;\n%}\n")
endif()
endif()
endif()
# Write the interface file
configure_file (${PROJECT_SOURCE_DIR}/src/swigme.i.in "${${varDotIFile}}" @ONLY)
endif()
endif ()
set(${varDotIFile} "${${varDotIFile}}" PARENT_SCOPE)
endfunction()

View File

@ -2,4 +2,5 @@ set (libname "adxl335")
set (libdescription "Low-power, 3-axis +/- 3 g Accelerometer")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
set (module_iface iAcceleration.hpp)
upm_module_init(mraa)

View File

@ -1,7 +1,33 @@
#ifdef SWIGPYTHON
%module (package="upm") adxl335
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
import java.lang.Integer;
%}
%{
#include <vector>
%}
%typemap(javaout) std::vector<int> {
return (AbstractList<Integer>)(new $&javaclassname($jnicall, true));
}
%typemap(jstype) std::vector<int> "AbstractList<Integer>"
%template(intVector) std::vector<int>;
%apply int *OUTPUT { int *xVal, int *yVal, int *zVal };
%apply float *OUTPUT { float *xAccel, float *yAccel, float *zAccel };
@ -41,6 +67,7 @@ JAVA_JNI_LOADLIBRARY(javaupm_adxl335)
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
%pointer_functions(int, intp);
%pointer_functions(float, floatp);
#endif
@ -48,6 +75,7 @@ JAVA_JNI_LOADLIBRARY(javaupm_adxl335)
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
%pointer_functions(int, intp);
%pointer_functions(float, floatp);
#endif

View File

@ -2,4 +2,5 @@ set (libname "adxl345")
set (libdescription "3-axis, +/- 2/4/8/16 g Digital Accelerometer")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
set (module_iface iAcceleration.hpp)
upm_module_init(mraa)

View File

@ -1,3 +1,9 @@
#ifdef SWIGPYTHON
%module (package="upm") adxl345
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
@ -29,6 +35,13 @@
delete [] $1;
}
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
JAVA_JNI_LOADLIBRARY(javaupm_adxl345)
#endif
/* END Java syntax */
@ -37,6 +50,7 @@ JAVA_JNI_LOADLIBRARY(javaupm_adxl345)
#ifdef SWIGJAVASCRIPT
%include "../carrays_int16_t.i"
%include "../carrays_float.i"
%include "../upm_vectortypes.i"
%typemap(out) int16_t * {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
@ -54,6 +68,7 @@ JAVA_JNI_LOADLIBRARY(javaupm_adxl345)
#ifdef SWIGPYTHON
%include "../carrays_int16_t.i"
%include "../carrays_float.i"
%include "../upm_vectortypes.i"
%typemap(out) int16_t * {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );

View File

@ -7,6 +7,7 @@ AUTOBOX(float, Float)
AUTOBOX(boolean, Boolean)
AUTOBOX(signed char, Byte)
AUTOBOX(short, Short)
AUTOBOX(unsigned char, Short)
AUTOBOX(int, Integer)
AUTOBOX(long, Long)
AUTOBOX(SWIGTYPE, $typemap(jstype,$1_basetype))

View File

@ -2,4 +2,5 @@ set (libname "bma220")
set (libdescription "Digital Triaxial Acceleration Sensor")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
set (module_iface iAcceleration.hpp)
upm_module_init(mraa)

View File

@ -1,3 +1,9 @@
#ifdef SWIGPYTHON
%module (package="upm") bma220
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
@ -25,6 +31,13 @@
%ignore getAccelerometer(float *, float *, float *);
%ignore installISR(int, mraa::Edge, void *, void *);
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
%define GETTER get_gpioIntr();
%enddef

View File

@ -4,6 +4,7 @@ upm_mixed_module_init (NAME bma250e
C_SRC bma250e.c
CPP_HDR bma250e.hpp
CPP_SRC bma250e.cxx
IFACE_HDR iAcceleration.hpp
FTI_SRC bma250e_fti.c
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -1,3 +1,9 @@
#ifdef SWIGPYTHON
%module (package="upm") bma250e
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
@ -8,6 +14,8 @@
%ignore installISR (BMA250E_INTERRUPT_PINS_T, int, mraa::Edge , void *, void *);
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
@ -15,12 +23,6 @@ import java.lang.Float;
%typemap(javaout) upm::BMA250E {
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>;
%define INTERRUPT BMA250E_INTERRUPT_PINS_T
%enddef

View File

@ -4,6 +4,7 @@ upm_mixed_module_init (NAME bmi160
C_SRC bmi160.c bosch_bmi160.c
CPP_HDR bmi160.hpp
CPP_SRC bmi160.cxx
IFACE_HDR iAcceleration.hpp
# FTI_SRC bmi160_fti.c
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -1,3 +1,9 @@
#ifdef SWIGPYTHON
%module (package="upm") bmi160
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
@ -22,18 +28,27 @@
%ignore getGyroscope(float *, float *, float *);
%ignore getMagnetometer(float *, float *, float *);
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
JAVA_JNI_LOADLIBRARY(javaupm_bmi160)
#endif
/* END Java syntax */
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
%pointer_functions(float, floatp);
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
%pointer_functions(float, floatp);
#endif
/* END Python syntax */

View File

@ -2,4 +2,5 @@ upm_mixed_module_init (NAME bmx055
DESCRIPTION "Bosch IMU Sensor Library"
CPP_HDR bmx055.hpp bmc150.hpp bmi055.hpp
CPP_SRC bmx055.cxx bmc150.cxx bmi055.cxx
IFACE_HDR iAcceleration.hpp
REQUIRES mraa bmg160 bma250e bmm150)

View File

@ -1,3 +1,9 @@
#ifdef SWIGPYTHON
%module (package="upm") bmx055
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
@ -11,20 +17,12 @@
%ignore getGyroscope(float *, float *, float *);
%typemap(javaimports) SWIGTYPE %{
import upm_new_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>;
JAVA_JNI_LOADLIBRARY(javaupm_bmx055)
#endif
/* END Java syntax */

View File

@ -2,4 +2,5 @@ set (libname "h3lis331dl")
set (libdescription "I2C 3-axis Digital Accelerometer (400g)")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
set (module_iface iAcceleration.hpp)
upm_module_init(mraa)

View File

@ -1,21 +1,52 @@
#ifdef SWIGPYTHON
%module (package="upm") h3lis331dl
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "std_vector.i"
%{
#include <vector>
%}
%apply float *OUTPUT { float *aX, float *aY, float *aZ };
%apply int *OUTPUT { int *x, int *y, int*z };
%ignore i2cContext;
%template(IntVector) std::vector<int>;
%template(FloatVector) std::vector<float>;
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
%typemap(javaout) std::vector<int> {
return (AbstractList<Integer>)(new $&javaclassname($jnicall, true));
}
%typemap(jstype) std::vector<int> "AbstractList<Integer>"
%template(intVector) std::vector<int>;
JAVA_JNI_LOADLIBRARY(javaupm_h3lis331dl)
#endif
/* END Java syntax */
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
#endif
/* END Python syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
%pointer_functions(int, intp);
%pointer_functions(float, floatp);

View File

@ -5,5 +5,6 @@ upm_mixed_module_init (NAME lis2ds12
CPP_HDR lis2ds12.hpp
CPP_SRC lis2ds12.cxx
FTI_SRC lis2ds12_fti.c
IFACE_HDR iAcceleration.hpp
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -1,3 +1,9 @@
#ifdef SWIGPYTHON
%module (package="upm") lis2ds12
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
@ -5,6 +11,13 @@
%ignore getAccelerometer(float *, float *, float *);
#%ignore installISR(LIS2DS12_INTERRUPT_PINS_T , int , mraa::Edge, void *, void *);
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
%define INTERRUPT LIS2DS12_INTERRUPT_PINS_T
%enddef
JAVA_ADD_INSTALLISR_INTERRUPT(upm::LIS2DS12)
@ -13,8 +26,19 @@ JAVA_JNI_LOADLIBRARY(javaupm_lis2ds12)
#endif
/* END Java syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
#endif
/* END Python syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
%{
#include "lis2ds12.hpp"
%}

View File

@ -5,5 +5,6 @@ upm_mixed_module_init (NAME lis3dh
CPP_HDR lis3dh.hpp
CPP_SRC lis3dh.cxx
FTI_SRC lis3dh_fti.c
IFACE_HDR iAcceleration.hpp
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -1,8 +1,13 @@
#ifdef SWIGPYTHON
%module (package="upm") lis3dh
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "../upm_vectortypes.i"
%ignore getAccelerometer(float *, float *, float *);
%ignore installISR(LIS3DH_INTERRUPT_PINS_T , int , mraa::Edge , void *, void* );
@ -10,13 +15,31 @@
%define INTERRUPT LIS3DH_INTERRUPT_PINS_T
%enddef
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
JAVA_ADD_INSTALLISR_INTERRUPT(upm::LIS3DH)
JAVA_JNI_LOADLIBRARY(javaupm_lis3dh)
#endif
/* END Java syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
#endif
/* END Python syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
%{
#include "lis3dh_defs.h"
#include "lis3dh.hpp"

View File

@ -5,5 +5,6 @@ upm_mixed_module_init (NAME lsm303agr
CPP_HDR lsm303agr.hpp
CPP_SRC lsm303agr.cxx
FTI_SRC lsm303agr_fti.c
IFACE_HDR iAcceleration.hpp
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -1,28 +1,25 @@
#ifdef SWIGPYTHON
%module (package="upm") lsm303agr
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "../upm_javastdvector.i"
%ignore getMagnetometer(float *, float *, float *);
%ignore getAccelerometer(float *, float *, float *);
%ignore installISR(LSM303AGR_INTERRUPT_PINS_T , int , mraa::Edge , void *, void *);
%typemap(javaimports) SWIGTYPE %{
import upm_new_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>;
%define INTERRUPT LSM303AGR_INTERRUPT_PINS_T
%enddef

View File

@ -4,5 +4,6 @@ upm_mixed_module_init (NAME lsm303d
C_SRC lsm303d.c
CPP_HDR lsm303d.hpp
CPP_SRC lsm303d.cxx
IFACE_HDR iAcceleration.hpp
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -1,27 +1,24 @@
#ifdef SWIGPYTHON
%module (package="upm") lsm303d
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "../upm_javastdvector.i"
%ignore getMagnetometer(float *, float *, float *);
%ignore getAccelerometer(float *, float *, float *);
%typemap(javaimports) SWIGTYPE %{
import upm_new_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>;
JAVA_JNI_LOADLIBRARY(javaupm_lsm303d)
#endif
/* END Java syntax */

View File

@ -5,5 +5,6 @@ upm_mixed_module_init (NAME lsm6ds3h
CPP_HDR lsm6ds3h.hpp
CPP_SRC lsm6ds3h.cxx
FTI_SRC lsm6ds3h_fti.c
IFACE_HDR iAcceleration.hpp
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -1,8 +1,19 @@
#ifdef SWIGPYTHON
%module (package="upm") lsm6ds3h
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "../upm_vectortypes.i"
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
%ignore getAccelerometer(float *, float *, float *);
%ignore getGyroscope(float *, float *, float *);
@ -17,8 +28,19 @@ JAVA_JNI_LOADLIBRARY(javaupm_lsm6ds3h)
#endif
/* END Java syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
#endif
/* END Python syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
%{
#include "lsm6ds3h_defs.h"
#include "lsm6ds3h.hpp"

View File

@ -4,6 +4,7 @@ upm_mixed_module_init (NAME lsm6dsl
C_SRC lsm6dsl.c
CPP_HDR lsm6dsl.hpp
CPP_SRC lsm6dsl.cxx
IFACE_HDR iAcceleration.hpp
FTI_SRC lsm6dsl_fti.c
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -1,9 +1,19 @@
#ifdef SWIGPYTHON
%module (package="upm") lsm6dsl
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "../upm_vectortypes.i"
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
%ignore getAccelerometer(float *, float *, float *);
%ignore getGyroscope(float *, float *, float *);
@ -17,8 +27,21 @@ JAVA_JNI_LOADLIBRARY(javaupm_lsm6dsl)
#endif
/* END Java syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
#endif
/* END Python syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
%include "std_vector.i"
%template(floatVector) std::vector<float>;
%{
#include "lsm6dsl_defs.h"
#include "lsm6dsl.hpp"

View File

@ -2,4 +2,5 @@ set (libname "lsm9ds0")
set (libdescription "Triaxial Gyroscope/accelerometer/magnetometer Sensor")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
set (module_iface iAcceleration.hpp)
upm_module_init(mraa)

View File

@ -1,3 +1,9 @@
#ifdef SWIGPYTHON
%module (package="upm") lsm9ds0
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
@ -5,6 +11,13 @@
%include "arrays_java.i";
%include "../java_buffer.i"
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
%apply int {mraa::Edge};
%apply float *INOUT { float *x, float *y, float *z };
@ -51,12 +64,14 @@ JAVA_JNI_LOADLIBRARY(javaupm_lsm9ds0)
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
%pointer_functions(float, floatp);
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
%pointer_functions(float, floatp);
#endif
/* END Python syntax */

View File

@ -2,4 +2,5 @@ set (libname "mma7455")
set (libdescription "Three Axis +/- 2/4/8 g Digital Accelerometer")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
set (module_iface iAcceleration.hpp)
upm_module_init(mraa)

View File

@ -1,17 +1,52 @@
#ifdef SWIGPYTHON
%module (package="upm") mma7455
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "arrays_java.i";
%include "../java_buffer.i"
%include "std_vector.i"
%apply short *OUTPUT { short * ptrX, short * ptrY, short * ptrZ };
%template(ShortVector) std::vector<short>;
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
import java.lang.Short;
%}
%{
#include <vector>
%}
%typemap(javaout) std::vector<short> {
return (AbstractList<Short>)(new $&javaclassname($jnicall, true));
}
%typemap(jstype) std::vector<short> "AbstractList<Short>"
%template(shortVector) std::vector<short>;
JAVA_JNI_LOADLIBRARY(javaupm_mma7455)
#endif
/* END Java syntax */
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
#endif
/* END Python syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
%{
#include "mma7455.hpp"

View File

@ -4,6 +4,7 @@ upm_mixed_module_init (NAME mma7660
C_SRC mma7660.c
CPP_HDR mma7660.hpp
CPP_SRC mma7660.cxx
IFACE_HDR iAcceleration.hpp
FTI_SRC mma7660_fti.c
CPP_WRAPS_C
REQUIRES mraa)

View File

@ -1,23 +1,57 @@
#ifdef SWIGPYTHON
%module (package="upm") mma7660
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA
%include "arrays_java.i";
%include "../java_buffer.i"
%include "std_vector.i"
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
import java.lang.Integer;
%}
%{
#include <vector>
%}
%typemap(javaout) std::vector<int> {
return (AbstractList<Integer>)(new $&javaclassname($jnicall, true));
}
%typemap(jstype) std::vector<int> "AbstractList<Integer>"
%template(intVector) std::vector<int>;
%apply float *OUTPUT { float *ax, float *ay, float *az };
%apply int *OUTPUT { int *x, int *y, int *z };
%ignore installISR(int , void *, void *);
%template(IntVector) std::vector<int>;
%template(FloatVector) std::vector<float>;
JAVA_ADD_INSTALLISR_PIN(upm::MMA7660)
JAVA_JNI_LOADLIBRARY(javaupm_mma7660)
#endif
/* END Java syntax */
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "../upm_vectortypes.i"
#endif
/* END Javascript syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "../upm_vectortypes.i"
#endif
/* END Python syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */
%pointer_functions(int, intp);
%pointer_functions(float, floatp);

View File

@ -2,4 +2,5 @@ set (libname "mma8x5x")
set (libdescription "Tri-axis Accelerometer Sensor")
set (module_src ${libname}.cpp)
set (module_hpp ${libname}.hpp)
set (module_iface iAcceleration.hpp)
upm_module_init(mraa)

View File

@ -2,4 +2,5 @@ set (libname "mpu9150")
set (libdescription "IMU Sensor Library Based On the Mpu9150")
set (module_src ${libname}.cxx ak8975.cxx mpu60x0.cxx mpu9250.cxx)
set (module_hpp ${libname}.hpp ak8975.hpp mpu60x0.hpp mpu9250.hpp)
set (module_iface iAcceleration.hpp)
upm_module_init(mraa)

View File

@ -1,3 +1,9 @@
#ifdef SWIGPYTHON
%module (package="upm") mpu9150
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */
@ -6,7 +12,12 @@
%include "arrays_java.i"
%include "../java_buffer.i"
%template(FloatVector) std::vector<float>;
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
import java.util.AbstractList;
import java.lang.Float;
%}
%apply int {mraa::Edge};
@ -22,6 +33,7 @@ JAVA_JNI_LOADLIBRARY(javaupm_mpu9150)
/* BEGIN Javascript syntax ------------------------------------------------- */
#ifdef SWIGJAVASCRIPT
%include "std_vector.i"
%include "../upm_vectortypes.i"
%pointer_functions(float, floatp);
#endif
/* END Javascript syntax */
@ -29,6 +41,7 @@ JAVA_JNI_LOADLIBRARY(javaupm_mpu9150)
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
%include "std_vector.i"
%include "../upm_vectortypes.i"
%pointer_functions(float, floatp);
#endif
/* END Python syntax */

View File

@ -1,16 +1,20 @@
/* This SWIG .i file is generated from UPM CMake. If additional functionality
* is required, custom .i files can be placed in the library directory.
*/
@PYTHON_NEW_INTERFACES@
@IMPORT_NEW_INTERFACES@
/* Common SWIG syntax */
%include "../common_top.i"
/* Java-specific SWIG syntax */
#ifdef SWIGJAVA
@JAVA_TYPEMAPS@
JAVA_JNI_LOADLIBRARY(javaupm_@libname@)
#endif
%{
@SWIG_HASH_INCLUDES@
%}
@SWIG_PERCENT_INCLUDES@
/* Java-specific SWIG syntax */
#ifdef SWIGJAVA
JAVA_JNI_LOADLIBRARY(javaupm_@libname@)
#endif