Added bindings for iMotion and iPressure sensors.

Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
This commit is contained in:
Serban Waltter 2018-06-21 16:46:09 +03:00
parent 0483ffcff4
commit 75dced21be
11 changed files with 66 additions and 5 deletions

View File

@ -0,0 +1,29 @@
/**
* Author: Serban Waltter <serban.waltter@rinftech.com>
*/
import java.util.ArrayList;
import upm_bmp280.BMP280;
import upm_hp20x.HP20X;
import upm_ms5611.MS5611;
import upm_new_interfaces.*;
/**
* iPressure_Example
*/
public class iPressure_Example {
public static void main(String[] args) {
ArrayList<iPressure> sensors = new ArrayList<iPressure>();
sensors.add(new BMP280(2));
sensors.add(new HP20X(3));
sensors.add(new MS5611(4));
while (true) {
for (int i = 0; i < sensors.size(); i++) {
System.out.println("Pressure from sensor " + i + " is " + sensors.get(i).getPressure());
}
}
}
}

View File

@ -4,6 +4,7 @@ upm_mixed_module_init (NAME biss0001
C_SRC biss0001.c C_SRC biss0001.c
CPP_HDR biss0001.hpp CPP_HDR biss0001.hpp
CPP_SRC biss0001.cxx CPP_SRC biss0001.cxx
IFACE_HDR iMotion.hpp
FTI_SRC biss0001_fti.c FTI_SRC biss0001_fti.c
CPP_WRAPS_C CPP_WRAPS_C
REQUIRES mraa) REQUIRES mraa)

View File

@ -4,6 +4,7 @@ upm_mixed_module_init (NAME bmpx8x
C_SRC bmpx8x.c C_SRC bmpx8x.c
CPP_HDR bmpx8x.hpp CPP_HDR bmpx8x.hpp
CPP_SRC bmpx8x.cxx CPP_SRC bmpx8x.cxx
IFACE_HDR iPressure.hpp
FTI_SRC bmpx8x_fti.c FTI_SRC bmpx8x_fti.c
CPP_WRAPS_C CPP_WRAPS_C
REQUIRES mraa interfaces utilities-c) REQUIRES mraa interfaces utilities-c)

View File

@ -1,16 +1,21 @@
#ifdef SWIGPYTHON
%module (package="upm") htu21d
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i" %include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */ /* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA #ifdef SWIGJAVA
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
%}
JAVA_JNI_LOADLIBRARY(javaupm_bmpx8x) JAVA_JNI_LOADLIBRARY(javaupm_bmpx8x)
#endif #endif
/* END Java syntax */ /* END Java syntax */
/* BEGIN Python syntax ----------------------------------------------------- */
#ifdef SWIGPYTHON
#endif
/* END Python syntax */
/* BEGIN Common SWIG syntax ------------------------------------------------- */ /* BEGIN Common SWIG syntax ------------------------------------------------- */
%{ %{
#include "bmpx8x_defs.h" #include "bmpx8x_defs.h"

View File

@ -2,4 +2,5 @@ set (libname "hp20x")
set (libdescription "High-accuracy Barometer") set (libdescription "High-accuracy Barometer")
set (module_src ${libname}.cxx) set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp) set (module_hpp ${libname}.hpp)
set (module_iface iPressure.hpp iTemperature.hpp)
upm_module_init(mraa) upm_module_init(mraa)

View File

@ -2,4 +2,5 @@ set (libname "mpl3115a2")
set (libdescription "I2C Precision Altimeter") set (libdescription "I2C Precision Altimeter")
set (module_src ${libname}.cpp) set (module_src ${libname}.cpp)
set (module_hpp ${libname}.hpp) set (module_hpp ${libname}.hpp)
set (module_iface iPressure.hpp)
upm_module_init(mraa) upm_module_init(mraa)

View File

@ -2,4 +2,5 @@ set (libname "ms5611")
set (libdescription "Barometric Pressure and Temperature Sensor") set (libdescription "Barometric Pressure and Temperature Sensor")
set (module_src ${libname}.cxx) set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp) set (module_hpp ${libname}.hpp)
set (module_iface iPressure.hpp iTemperature.hpp)
upm_module_init(mraa interfaces) upm_module_init(mraa interfaces)

View File

@ -1,7 +1,17 @@
#ifdef SWIGPYTHON
%module (package="upm") htu21d
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i" %include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */ /* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA #ifdef SWIGJAVA
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
%}
JAVA_JNI_LOADLIBRARY(javaupm_ms5611) JAVA_JNI_LOADLIBRARY(javaupm_ms5611)
#endif #endif
/* END Java syntax */ /* END Java syntax */

View File

@ -4,6 +4,7 @@ upm_mixed_module_init (NAME ms5803
C_SRC ms5803.c C_SRC ms5803.c
CPP_HDR ms5803.hpp CPP_HDR ms5803.hpp
CPP_SRC ms5803.cxx CPP_SRC ms5803.cxx
IFACE_HDR iPressure.hpp iTemperature.hpp
FTI_SRC ms5803_fti.c FTI_SRC ms5803_fti.c
CPP_WRAPS_C CPP_WRAPS_C
REQUIRES mraa utilities-c) REQUIRES mraa utilities-c)

View File

@ -1,7 +1,17 @@
#ifdef SWIGPYTHON
%module (package="upm") htu21d
#endif
%import "interfaces/new_interfaces.i"
%include "../common_top.i" %include "../common_top.i"
/* BEGIN Java syntax ------------------------------------------------------- */ /* BEGIN Java syntax ------------------------------------------------------- */
#ifdef SWIGJAVA #ifdef SWIGJAVA
%typemap(javaimports) SWIGTYPE %{
import upm_new_interfaces.*;
%}
%include "arrays_java.i" %include "arrays_java.i"
%include "../java_buffer.i" %include "../java_buffer.i"

View File

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