Merge 1895004cf5112366b2effa9f71e58c3f9cf025cc into 74b5ec00dc18d534dcc3442b1c23ee0ada2738ec

This commit is contained in:
Stefan Andritoiu 2018-01-23 20:17:06 +00:00 committed by GitHub
commit f757debb38
252 changed files with 606 additions and 2618 deletions

View File

@ -437,16 +437,10 @@ function(upm_swig_java)
set_source_files_properties (javaupm_${libname}.i PROPERTIES CPLUSPLUS ON) set_source_files_properties (javaupm_${libname}.i PROPERTIES CPLUSPLUS ON)
set_source_files_properties (javaupm_${libname}.i PROPERTIES SWIG_FLAGS ";-package;upm_${libname};-I${CMAKE_BINARY_DIR}/src") set_source_files_properties (javaupm_${libname}.i PROPERTIES SWIG_FLAGS ";-package;upm_${libname};-I${CMAKE_BINARY_DIR}/src")
# NOTE, ${module_src} is ONLY needed when swig'ing to JAVA. This is
# because *some* upm libraries have ifdef's for JAVA and SWIG in their
# source (cxx) which builds in different functionality. Because of this,
# the source must be added when building the JAVA wrapper.
# See issue #518
# TODO: Fix this somehow
if (CMAKE_VERSION VERSION_LESS "3.8") if (CMAKE_VERSION VERSION_LESS "3.8")
swig_add_module (javaupm_${libname} java javaupm_${libname}.i ${module_src}) swig_add_module (javaupm_${libname} java javaupm_${libname}.i)
else () else ()
swig_add_library (javaupm_${libname} LANGUAGE java SOURCES javaupm_${libname}.i ${module_src}) swig_add_library (javaupm_${libname} LANGUAGE java SOURCES javaupm_${libname}.i)
endif () endif ()
# If the C++ target depends on C++ interfaces, make the JAVA target # If the C++ target depends on C++ interfaces, make the JAVA target

77
src/_upm.i Normal file
View File

@ -0,0 +1,77 @@
/* Macro for adding JAVA run
usage: JAVA_ADD_INSTALLISR(javaupm_a110x)
*/
%define JAVA_ADD_INSTALLISR(UPM_Classname)
%extend UPM_Classname {
void installISR(jobject runnable)
{
$self->installISR(mraa_java_isr_callback, runnable);
}
}
%enddef
/* Define GETTER in the appropiate .i file with the getter function name
*/
%define JAVA_ADD_INSTALLISR_GPIO(UPM_Classname)
%extend UPM_Classname {
void installISR(int gpio, mraa::Edge level, jobject runnable)
{
// delete any existing ISR and GPIO context
$self->uninstallISR();
// create gpio context
mraa::Gpio* swg_gpioIntr = $self->GETTER;
swg_gpioIntr->dir(mraa::DIR_IN);
swg_gpioIntr->isr(level, runnable);
}
}
%enddef
/* Define INTERRUPT in the appropiate .i file with the interrupt type
*/
%define JAVA_ADD_INSTALLISR_INTERRUPT(UPM_Classname)
%extend UPM_Classname {
void installISR(INTERRUPT intr, int gpio,
mraa::Edge level, jobject runnable)
{
$self->installISR(intr, gpio, level, mraa_java_isr_callback, runnable);
}
}
%enddef
%define JAVA_ADD_INSTALLISR_EDGE(UPM_Classname)
%extend UPM_Classname {
void installISR(mraa::Edge level, jobject runnable)
{
$self->installISR(level, mraa_java_isr_callback, runnable);
}
}
%enddef
%define JAVA_ADD_INSTALLISR_PIN(UPM_Classname)
%extend UPM_Classname {
void installISR(int pin, jobject runnable)
{
$self->installISR(pin, mraa_java_isr_callback, runnable);
}
}
%enddef
/* Macro for adding JNI loadLibrary dependency
usage: JAVA_JNI_LOADLIBRARY(javaupm_rhusb)
*/
%define JAVA_JNI_LOADLIBRARY(MyModuleName)
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("MyModuleName");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library (MyModuleName) failed to load. \n" + e);
System.exit(1);
}
}
%}
%enddef

View File

@ -57,13 +57,6 @@ bool A110X::magnetDetected()
return (!mraa_gpio_read(m_gpio) ? true : false); return (!mraa_gpio_read(m_gpio) ? true : false);
} }
#ifdef JAVACALLBACK
void A110X::installISR(jobject runnable)
{
installISR(mraa_java_isr_callback, runnable);
}
#endif
void A110X::installISR(void (*isr)(void *), void *arg) void A110X::installISR(void (*isr)(void *), void *arg)
{ {
if (m_isrInstalled) if (m_isrInstalled)

View File

@ -85,11 +85,8 @@ namespace upm {
* @param arg Pointer to an object to be supplied as an * @param arg Pointer to an object to be supplied as an
* argument to the ISR. * argument to the ISR.
*/ */
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(jobject runnable);
#else
void installISR(void (*isr)(void *), void *arg); void installISR(void (*isr)(void *), void *arg);
#endif
/** /**
* Uninstalls the previously installed ISR * Uninstalls the previously installed ISR
* *
@ -97,9 +94,6 @@ namespace upm {
void uninstallISR(); void uninstallISR();
private: private:
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(void (*isr)(void *), void *arg);
#endif
bool m_isrInstalled; bool m_isrInstalled;
mraa_gpio_context m_gpio; mraa_gpio_context m_gpio;

6
src/a110x/common.i Normal file
View File

@ -0,0 +1,6 @@
%include "../upm.i"
%{
#include "a110x.hpp"
%}
%include "a110x.hpp"

View File

@ -1,20 +1,11 @@
%module javaupm_a110x %module javaupm_a110x
%include "../upm.i"
%include "stdint.i" %include "stdint.i"
%include "typemaps.i" %include "typemaps.i"
%{ %include "common.i"
#include "a110x.hpp"
%}
%include "a110x.hpp"
%pragma(java) jniclasscode=%{ /* Macro for loading javaupm_a110x */
static { JAVA_JNI_LOADLIBRARY(javaupm_a110x)
try {
System.loadLibrary("javaupm_a110x"); /* Macro adding an installisr call w/JAVA runnable to A110X */
} catch (UnsatisfiedLinkError e) { JAVA_ADD_INSTALLISR(upm::A110X)
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -1,8 +1,3 @@
%module jsupm_a110x %module jsupm_a110x
%include "../upm.i"
%{ %include "common.i"
#include "a110x.hpp"
%}
%include "a110x.hpp"

View File

@ -1,9 +1,4 @@
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i" %include "pyupm_doxy2swig.i"
%module pyupm_a110x %module pyupm_a110x
%include "../upm.i"
%include "a110x.hpp" %include "common.i"
%{
#include "a110x.hpp"
%}

View File

@ -8,13 +8,4 @@
%} %}
%include "abp.hpp" %include "abp.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_abp)
static {
try {
System.loadLibrary("javaupm_abp");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "ad8232.hpp" %include "ad8232.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ad8232)
static {
try {
System.loadLibrary("javaupm_ad8232");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "adafruitms1438.hpp" %include "adafruitms1438.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_adafruitms1438)
static {
try {
System.loadLibrary("javaupm_adafruitms1438");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -6,13 +6,4 @@
#include "adafruitss.hpp" #include "adafruitss.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_adafruitss)
static {
try {
System.loadLibrary("javaupm_adafruitss");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -8,13 +8,4 @@
%include "adc121c021.hpp" %include "adc121c021.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_adc121c021)
static {
try {
System.loadLibrary("javaupm_adc121c021");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "adis16448.hpp" %include "adis16448.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_adis16448)
static {
try {
System.loadLibrary("javaupm_adis16448");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -18,13 +18,4 @@ import upm_interfaces.*;
%include "ads1015.hpp" %include "ads1015.hpp"
%include "ads1115.hpp" %include "ads1115.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ads1x15)
static {
try {
System.loadLibrary("javaupm_ads1x15");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -42,13 +42,4 @@
%include "adxl335.hpp" %include "adxl335.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_adxl335)
static {
try {
System.loadLibrary("javaupm_adxl335");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -35,13 +35,4 @@
%include "adxl345.hpp" %include "adxl345.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_adxl345)
static {
try {
System.loadLibrary("javaupm_adxl345");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "adxrs610.hpp" %include "adxrs610.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_adxrs610)
static {
try {
System.loadLibrary("javaupm_adxrs610");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "am2315.hpp" %include "am2315.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_am2315)
static {
try {
System.loadLibrary("javaupm_am2315");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -18,13 +18,4 @@
%include "apa102.hpp" %include "apa102.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_apa102)
static {
try {
System.loadLibrary("javaupm_apa102");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "apds9002.hpp" %include "apds9002.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_apds9002)
static {
try {
System.loadLibrary("javaupm_apds9002");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -6,13 +6,4 @@
%} %}
%include "apds9930.hpp" %include "apds9930.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_apds9930)
static {
try {
System.loadLibrary("javaupm_apds9930");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "at42qt1070.hpp" %include "at42qt1070.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_at42qt1070)
static {
try {
System.loadLibrary("javaupm_at42qt1070");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -11,13 +11,4 @@
%include "bacnetmstp.hpp" %include "bacnetmstp.hpp"
%include "bacnetutil.hpp" %include "bacnetutil.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_bacnetmstp)
static {
try {
System.loadLibrary("javaupm_bacnetmstp");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -10,13 +10,4 @@
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_bh1750)
static {
try {
System.loadLibrary("javaupm_bh1750");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "biss0001.hpp" %include "biss0001.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_biss0001)
static {
try {
System.loadLibrary("javaupm_biss0001");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -42,7 +42,7 @@ BMA220::BMA220(int bus, uint8_t addr) :
m_accelX = 0.0; m_accelX = 0.0;
m_accelY = 0.0; m_accelY = 0.0;
m_accelZ = 0.0; m_accelZ = 0.0;
m_accelScale = 0.0; m_accelScale = 0.0;
mraa::Result rv; mraa::Result rv;
@ -59,7 +59,7 @@ BMA220::BMA220(int bus, uint8_t addr) :
// set scaling rate // set scaling rate
if (!setAccelerometerScale(FSL_RANGE_2G)) if (!setAccelerometerScale(FSL_RANGE_2G))
{ {
throw std::runtime_error(string(__FUNCTION__) + throw std::runtime_error(string(__FUNCTION__) +
": Unable to set accel scale"); ": Unable to set accel scale");
return; return;
} }
@ -107,8 +107,8 @@ bool BMA220::writeReg(uint8_t reg, uint8_t val)
throw std::runtime_error(std::string(__FUNCTION__) + throw std::runtime_error(std::string(__FUNCTION__) +
": I2c.writeReg() failed"); ": I2c.writeReg() failed");
return false; return false;
} }
return true; return true;
} }
@ -126,11 +126,11 @@ bool BMA220::setAccelerometerScale(FSL_RANGE_T scale)
} }
// store scaling factor // store scaling factor
switch (scale) switch (scale)
{ {
case FSL_RANGE_2G: case FSL_RANGE_2G:
m_accelScale = 16.0; m_accelScale = 16.0;
break; break;
case FSL_RANGE_4G: case FSL_RANGE_4G:
@ -147,7 +147,7 @@ bool BMA220::setAccelerometerScale(FSL_RANGE_T scale)
default: // should never occur, but... default: // should never occur, but...
m_accelScale = 0.0; // set a safe, though incorrect value m_accelScale = 0.0; // set a safe, though incorrect value
throw std::logic_error(string(__FUNCTION__) + throw std::logic_error(string(__FUNCTION__) +
": internal error, unsupported scale"); ": internal error, unsupported scale");
break; break;
} }
@ -193,7 +193,7 @@ bool BMA220::setFilterConfig(FILTER_CONFIG_T filter)
reg &= ~(_FILTER_CONFIG_FILTER_MASK << _FILTER_CONFIG_FILTER_SHIFT); reg &= ~(_FILTER_CONFIG_FILTER_MASK << _FILTER_CONFIG_FILTER_SHIFT);
reg |= (filter << _FILTER_CONFIG_FILTER_SHIFT); reg |= (filter << _FILTER_CONFIG_FILTER_SHIFT);
return writeReg(REG_FILTER_CONFIG, reg); return writeReg(REG_FILTER_CONFIG, reg);
} }
@ -205,7 +205,7 @@ bool BMA220::setSerialHighBW(bool high)
reg |= FILTER_CONFIG_SERIAL_HIGH_BW; reg |= FILTER_CONFIG_SERIAL_HIGH_BW;
else else
reg &= ~FILTER_CONFIG_SERIAL_HIGH_BW; reg &= ~FILTER_CONFIG_SERIAL_HIGH_BW;
return writeReg(REG_FILTER_CONFIG, reg); return writeReg(REG_FILTER_CONFIG, reg);
} }
@ -260,7 +260,7 @@ bool BMA220::setSleepDuration(SLEEP_DUR_T dur)
reg &= ~(_ENABLE_CONFIG3_SLEEP_DUR_MASK << _ENABLE_CONFIG3_SLEEP_DUR_SHIFT); reg &= ~(_ENABLE_CONFIG3_SLEEP_DUR_MASK << _ENABLE_CONFIG3_SLEEP_DUR_SHIFT);
reg |= (dur << _ENABLE_CONFIG3_SLEEP_DUR_SHIFT); reg |= (dur << _ENABLE_CONFIG3_SLEEP_DUR_SHIFT);
return writeReg(REG_ENABLE_CONFIG3, reg); return writeReg(REG_ENABLE_CONFIG3, reg);
} }
@ -273,7 +273,7 @@ bool BMA220::setLowGThreshold(uint8_t thresh)
reg &= ~(_THRESHOLD_LOW_MASK << _THRESHOLD_LOW_SHIFT); reg &= ~(_THRESHOLD_LOW_MASK << _THRESHOLD_LOW_SHIFT);
reg |= (thresh << _THRESHOLD_LOW_SHIFT); reg |= (thresh << _THRESHOLD_LOW_SHIFT);
return writeReg(REG_THRESHOLD, reg); return writeReg(REG_THRESHOLD, reg);
} }
@ -286,7 +286,7 @@ bool BMA220::setHighGThreshold(uint8_t thresh)
reg &= ~(_THRESHOLD_HIGH_MASK << _THRESHOLD_HIGH_SHIFT); reg &= ~(_THRESHOLD_HIGH_MASK << _THRESHOLD_HIGH_SHIFT);
reg |= (thresh << _THRESHOLD_HIGH_SHIFT); reg |= (thresh << _THRESHOLD_HIGH_SHIFT);
return writeReg(REG_THRESHOLD, reg); return writeReg(REG_THRESHOLD, reg);
} }
@ -299,7 +299,7 @@ bool BMA220::setLowGHysteresis(uint8_t hyst)
reg &= ~(_L_HYST_DUR_LOW_HY_MASK << _L_HYST_DUR_LOW_HY_SHIFT); reg &= ~(_L_HYST_DUR_LOW_HY_MASK << _L_HYST_DUR_LOW_HY_SHIFT);
reg |= (hyst << _L_HYST_DUR_LOW_HY_SHIFT); reg |= (hyst << _L_HYST_DUR_LOW_HY_SHIFT);
return writeReg(REG_L_HYST_DUR, reg); return writeReg(REG_L_HYST_DUR, reg);
} }
@ -312,7 +312,7 @@ bool BMA220::setLowGDuration(uint8_t dur)
reg &= ~(_L_HYST_DUR_LOW_DUR_MASK << _L_HYST_DUR_LOW_DUR_SHIFT); reg &= ~(_L_HYST_DUR_LOW_DUR_MASK << _L_HYST_DUR_LOW_DUR_SHIFT);
reg |= (dur << _L_HYST_DUR_LOW_DUR_SHIFT); reg |= (dur << _L_HYST_DUR_LOW_DUR_SHIFT);
return writeReg(REG_L_HYST_DUR, reg); return writeReg(REG_L_HYST_DUR, reg);
} }
@ -325,7 +325,7 @@ bool BMA220::setHighGHysteresis(uint8_t hyst)
reg &= ~(_H_HYST_DUR_HIGH_HY_MASK << _H_HYST_DUR_HIGH_HY_SHIFT); reg &= ~(_H_HYST_DUR_HIGH_HY_MASK << _H_HYST_DUR_HIGH_HY_SHIFT);
reg |= (hyst << _H_HYST_DUR_HIGH_HY_SHIFT); reg |= (hyst << _H_HYST_DUR_HIGH_HY_SHIFT);
return writeReg(REG_H_HYST_DUR, reg); return writeReg(REG_H_HYST_DUR, reg);
} }
@ -338,7 +338,7 @@ bool BMA220::setHighGDuration(uint8_t dur)
reg &= ~(_H_HYST_DUR_HIGH_DUR_MASK << _H_HYST_DUR_HIGH_DUR_SHIFT); reg &= ~(_H_HYST_DUR_HIGH_DUR_MASK << _H_HYST_DUR_HIGH_DUR_SHIFT);
reg |= (dur << _H_HYST_DUR_HIGH_DUR_SHIFT); reg |= (dur << _H_HYST_DUR_HIGH_DUR_SHIFT);
return writeReg(REG_H_HYST_DUR, reg); return writeReg(REG_H_HYST_DUR, reg);
} }
@ -351,7 +351,7 @@ bool BMA220::setTapDuration(uint8_t dur)
reg &= ~(_TAP_CONFIG_DUR_MASK << _TAP_CONFIG_DUR_SHIFT); reg &= ~(_TAP_CONFIG_DUR_MASK << _TAP_CONFIG_DUR_SHIFT);
reg |= (dur << _TAP_CONFIG_DUR_SHIFT); reg |= (dur << _TAP_CONFIG_DUR_SHIFT);
return writeReg(REG_TAP_CONFIG, reg); return writeReg(REG_TAP_CONFIG, reg);
} }
@ -364,7 +364,7 @@ bool BMA220::setTapThreshold(uint8_t thresh)
reg &= ~(_TAP_CONFIG_THRESH_MASK << _TAP_CONFIG_THRESH_SHIFT); reg &= ~(_TAP_CONFIG_THRESH_MASK << _TAP_CONFIG_THRESH_SHIFT);
reg |= (thresh << _TAP_CONFIG_THRESH_SHIFT); reg |= (thresh << _TAP_CONFIG_THRESH_SHIFT);
return writeReg(REG_TAP_CONFIG, reg); return writeReg(REG_TAP_CONFIG, reg);
} }
@ -389,7 +389,7 @@ bool BMA220::setSlopeDuration(uint8_t dur)
reg &= ~(_SLOPE_CONFIG_DUR_MASK << _SLOPE_CONFIG_DUR_SHIFT); reg &= ~(_SLOPE_CONFIG_DUR_MASK << _SLOPE_CONFIG_DUR_SHIFT);
reg |= (dur << _SLOPE_CONFIG_DUR_SHIFT); reg |= (dur << _SLOPE_CONFIG_DUR_SHIFT);
return writeReg(REG_SLOPE_CONFIG, reg); return writeReg(REG_SLOPE_CONFIG, reg);
} }
@ -402,7 +402,7 @@ bool BMA220::setSlopeThreshold(uint8_t thresh)
reg &= ~(_SLOPE_CONFIG_THRESH_MASK << _SLOPE_CONFIG_THRESH_SHIFT); reg &= ~(_SLOPE_CONFIG_THRESH_MASK << _SLOPE_CONFIG_THRESH_SHIFT);
reg |= (thresh << _SLOPE_CONFIG_THRESH_SHIFT); reg |= (thresh << _SLOPE_CONFIG_THRESH_SHIFT);
return writeReg(REG_SLOPE_CONFIG, reg); return writeReg(REG_SLOPE_CONFIG, reg);
} }
@ -474,7 +474,7 @@ bool BMA220::setInterruptLatch(CONFIG2_LAT_T lat)
reg &= ~(_ENABLE_CONFIG2_LAT_INT_MASK << _ENABLE_CONFIG2_LAT_INT_SHIFT); reg &= ~(_ENABLE_CONFIG2_LAT_INT_MASK << _ENABLE_CONFIG2_LAT_INT_SHIFT);
reg |= (lat << _ENABLE_CONFIG2_LAT_INT_SHIFT); reg |= (lat << _ENABLE_CONFIG2_LAT_INT_SHIFT);
return writeReg(REG_ENABLE_CONFIG2, reg); return writeReg(REG_ENABLE_CONFIG2, reg);
} }
@ -489,22 +489,8 @@ bool BMA220::resetInterrupts()
return writeReg(REG_ENABLE_CONFIG2, reg); return writeReg(REG_ENABLE_CONFIG2, reg);
} }
#if defined(SWIGJAVA) || (JAVACALLBACK)
void BMA220::installISR(int gpio, mraa::Edge level, void BMA220::installISR(int gpio, mraa::Edge level,
jobject runnable)
{
// delete any existing ISR and GPIO context
uninstallISR();
// create gpio context
m_gpioIntr = new mraa::Gpio(gpio);
m_gpioIntr->dir(mraa::DIR_IN);
m_gpioIntr->isr(level, runnable);
}
#else
void BMA220::installISR(int gpio, mraa::Edge level,
void (*isr)(void *), void *arg) void (*isr)(void *), void *arg)
{ {
// delete any existing ISR and GPIO context // delete any existing ISR and GPIO context
@ -516,7 +502,6 @@ void BMA220::installISR(int gpio, mraa::Edge level,
m_gpioIntr->dir(mraa::DIR_IN); m_gpioIntr->dir(mraa::DIR_IN);
m_gpioIntr->isr(level, isr, arg); m_gpioIntr->isr(level, isr, arg);
} }
#endif
void BMA220::uninstallISR() void BMA220::uninstallISR()
{ {
@ -524,8 +509,12 @@ void BMA220::uninstallISR()
{ {
m_gpioIntr->isrExit(); m_gpioIntr->isrExit();
delete m_gpioIntr; delete m_gpioIntr;
m_gpioIntr = 0; m_gpioIntr = 0;
} }
} }
mraa::Gpio* BMA220::get_gpioIntr()
{
return m_gpioIntr;
}

View File

@ -32,7 +32,7 @@
#define BMA220_DEFAULT_ADDR 0x0a #define BMA220_DEFAULT_ADDR 0x0a
namespace upm { namespace upm {
/** /**
* @brief BMA220 Accelerometer library * @brief BMA220 Accelerometer library
* @defgroup bma220 libupm-bma220 * @defgroup bma220 libupm-bma220
@ -115,7 +115,7 @@ namespace upm {
REG_SUSPEND = 0x30, REG_SUSPEND = 0x30,
REG_SOFTRESET = 0x32 REG_SOFTRESET = 0x32
} REG_T; } REG_T;
/** /**
* REG_H_HYST_DUR bits * REG_H_HYST_DUR bits
@ -271,7 +271,7 @@ namespace upm {
INT_STATUS1_ORIENT_INT = 0x80 // orient intr was generated INT_STATUS1_ORIENT_INT = 0x80 // orient intr was generated
} INT_STATUS1_BITS_T; } INT_STATUS1_BITS_T;
/** /**
* INT_STATUS1_ORIENT values * INT_STATUS1_ORIENT values
* *
@ -485,7 +485,7 @@ namespace upm {
* BMA220 Destructor * BMA220 Destructor
*/ */
~BMA220(); ~BMA220();
/** /**
* update the accelerometer values * update the accelerometer values
*/ */
@ -776,9 +776,7 @@ namespace upm {
*/ */
bool resetInterrupts(); bool resetInterrupts();
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(int gpio, mraa::Edge level, jobject runnable);
#else
/** /**
* install an interrupt handler. * install an interrupt handler.
* *
@ -789,16 +787,17 @@ namespace upm {
* @param isr the interrupt handler, accepting a void * argument * @param isr the interrupt handler, accepting a void * argument
* @param arg the argument to pass the the interrupt handler * @param arg the argument to pass the the interrupt handler
*/ */
void installISR(int gpio, mraa::Edge level, void installISR(int gpio, mraa::Edge level,
void (*isr)(void *), void *arg); void (*isr)(void *), void *arg);
#endif
/** /**
* uninstall a previously installed interrupt handler * uninstall a previously installed interrupt handler
* *
*/ */
void uninstallISR(); void uninstallISR();
mraa::Gpio* get_gpioIntr();
protected: protected:
mraa::I2c m_i2c; mraa::I2c m_i2c;
mraa::Gpio *m_gpioIntr; mraa::Gpio *m_gpioIntr;
@ -821,13 +820,6 @@ namespace upm {
* update the accelerometer values * update the accelerometer values
*/ */
void updateAccelerometer(); void updateAccelerometer();
// Adding a private function definition for java bindings
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(int gpio, mraa::Edge level,
void (*isr)(void *), void *arg);
#endif
}; };
} }

View File

@ -30,13 +30,10 @@
%include "bma220.hpp" %include "bma220.hpp"
%pragma(java) jniclasscode=%{ %define GETTER get_gpioIntr();
static { %enddef
try { JAVA_ADD_INSTALLISR_GPIO(upm::BMA220)
System.loadLibrary("javaupm_bma220");
} catch (UnsatisfiedLinkError e) { %ignore installISR(int, mraa::Edge, void *, void *);
System.err.println("Native code library failed to load. \n" + e);
System.exit(1); JAVA_JNI_LOADLIBRARY(javaupm_bma220)
}
}
%}

View File

@ -518,14 +518,7 @@ namespace upm {
void setLowPowerMode2(); void setLowPowerMode2();
#if defined(SWIGJAVA) || defined(JAVACALLBACK) /**
void installISR(BMA250E_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level, jobject runnable)
{
installISR(intr, gpio, level, mraa_java_isr_callback, runnable);
}
#else
/**
* install an interrupt handler. * install an interrupt handler.
* *
* @param intr One of the BMA250E_INTERRUPT_PINS_T values * @param intr One of the BMA250E_INTERRUPT_PINS_T values
@ -541,7 +534,6 @@ namespace upm {
void installISR(BMA250E_INTERRUPT_PINS_T intr, int gpio, void installISR(BMA250E_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level, mraa::Edge level,
void (*isr)(void *), void *arg); void (*isr)(void *), void *arg);
#endif
/** /**
* uninstall a previously installed interrupt handler * uninstall a previously installed interrupt handler
@ -585,12 +577,6 @@ namespace upm {
/* Disable implicit copy and assignment operators */ /* Disable implicit copy and assignment operators */
BMA250E(const BMA250E&) = delete; BMA250E(const BMA250E&) = delete;
BMA250E &operator=(const BMA250E&) = delete; BMA250E &operator=(const BMA250E&) = delete;
// Adding a private function definition for java bindings
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(BMA250E_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level,
void (*isr)(void *), void *arg);
#endif
}; };
} }

View File

@ -20,19 +20,19 @@ import java.lang.Float;
%template(floatVector) std::vector<float>; %template(floatVector) std::vector<float>;
%include "bma250e_defs.h"
%include "bma250e.hpp"
%{ %{
#include "bma250e.hpp" #include "bma250e.hpp"
#include "bma250e_defs.h"
%} %}
%include "bma250e_defs.h"
%include "bma250e.hpp"
%pragma(java) jniclasscode=%{
static { %ignore installISR (BMA250E_INTERRUPT_PINS_T, int, mraa::Edge , void *, void *);
try {
System.loadLibrary("javaupm_bma250e"); %define INTERRUPT BMA250E_INTERRUPT_PINS_T
} catch (UnsatisfiedLinkError e) { %enddef
System.err.println("Native code library failed to load. \n" + e); JAVA_ADD_INSTALLISR_INTERRUPT(upm::BMA250E)
System.exit(1);
}
} JAVA_JNI_LOADLIBRARY(javaupm_bma250e)
%}

View File

@ -415,13 +415,6 @@ namespace upm {
*/ */
void enableOutputFiltering(bool filter); void enableOutputFiltering(bool filter);
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level, jobject runnable)
{
installISR(intr, gpio, level, mraa_java_isr_callback, runnable);
}
#else
/** /**
* install an interrupt handler. * install an interrupt handler.
* *
@ -439,7 +432,6 @@ namespace upm {
void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio, void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level, mraa::Edge level,
void (*isr)(void *), void *arg); void (*isr)(void *), void *arg);
#endif
/** /**
* uninstall a previously installed interrupt handler * uninstall a previously installed interrupt handler
@ -484,11 +476,5 @@ namespace upm {
BMG160(const BMG160&) = delete; BMG160(const BMG160&) = delete;
BMG160 &operator=(const BMG160&) = delete; BMG160 &operator=(const BMG160&) = delete;
// needs to be private for SWIG Java builds
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level,
void (*isr)(void *), void *arg);
#endif
}; };
} }

View File

@ -20,19 +20,18 @@ import java.lang.Float;
%template(floatVector) std::vector<float>; %template(floatVector) std::vector<float>;
%include "bmg160_defs.h"
%include "bmg160.hpp"
%{ %{
#include "bmg160.hpp" #include "bmg160.hpp"
#include "bmg160_defs.h"
%} %}
%include "bmg160_defs.h"
%include "bmg160.hpp"
%pragma(java) jniclasscode=%{
static { %ignore installISR (BMG160_INTERRUPT_PINS_T , int mraa::Edge , void *, void *);
try {
System.loadLibrary("javaupm_bmg160"); %define INTERRUPT BMG160_INTERRUPT_PINS_T
} catch (UnsatisfiedLinkError e) { %enddef
System.err.println("Native code library failed to load. \n" + e); JAVA_ADD_INSTALLISR_INTERRUPT(upm::BMG160)
System.exit(1);
} JAVA_JNI_LOADLIBRARY(javaupm_bmg160)
}
%}

View File

@ -30,13 +30,4 @@
%include "bmi160.hpp" %include "bmi160.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_bmi160)
static {
try {
System.loadLibrary("javaupm_bmi160");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -281,14 +281,6 @@ namespace upm {
*/ */
void setRepetitionsZ(uint8_t reps); void setRepetitionsZ(uint8_t reps);
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(BMM150_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level,
jobject runnable)
{
installISR(intr, gpio, level, mraa_java_isr_callback, runnable);
}
#else
/** /**
* Install an interrupt handler. * Install an interrupt handler.
* *
@ -305,7 +297,6 @@ namespace upm {
void installISR(BMM150_INTERRUPT_PINS_T intr, int gpio, void installISR(BMM150_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level, mraa::Edge level,
void (*isr)(void *), void *arg); void (*isr)(void *), void *arg);
#endif
/** /**
* Uninstall a previously installed interrupt handler. * Uninstall a previously installed interrupt handler.
@ -350,11 +341,5 @@ namespace upm {
BMM150(const BMM150&) = delete; BMM150(const BMM150&) = delete;
BMM150 &operator=(const BMM150&) = delete; BMM150 &operator=(const BMM150&) = delete;
// Adding a private function definition for java bindings
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(BMM150_INTERRUPT_PINS_T intr, int gpio,
mraa::Edge level,
void (*isr)(void *), void *arg);
#endif
}; };
} }

View File

@ -20,19 +20,17 @@ import java.lang.Float;
%template(floatVector) std::vector<float>; %template(floatVector) std::vector<float>;
%include "bmm150_defs.h"
%include "bmm150.hpp"
%{ %{
#include "bmm150.hpp" #include "bmm150.hpp"
#include "bmm150_defs.h"
%} %}
%include "bmm150_defs.h"
%include "bmm150.hpp"
%pragma(java) jniclasscode=%{ %ignore installISR (BMM150_INTERRUPT_PINS_T , int , mraa::Edge , void *, void *);
static {
try { %define INTERRUPT BMM150_INTERRUPT_PINS_T
System.loadLibrary("javaupm_bmm150"); %enddef
} catch (UnsatisfiedLinkError e) { JAVA_ADD_INSTALLISR_INTERRUPT(upm::BMM150)
System.err.println("Native code library failed to load. \n" + e);
System.exit(1); JAVA_JNI_LOADLIBRARY(javaupm_bmm150)
}
}
%}

View File

@ -26,13 +26,4 @@
#include "bme280.hpp" #include "bme280.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_bmp280)
static {
try {
System.loadLibrary("javaupm_bmp280");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -15,13 +15,4 @@ import upm_interfaces.*;
%include "bmpx8x_defs.h" %include "bmpx8x_defs.h"
%include "bmpx8x.hpp" %include "bmpx8x.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_bmpx8x)
static {
try {
System.loadLibrary("javaupm_bmpx8x");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -44,13 +44,4 @@ import java.lang.Float;
#include "bmi055.hpp" #include "bmi055.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_bmx055)
static {
try {
System.loadLibrary("javaupm_bmx055");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -622,12 +622,6 @@ namespace upm {
BNO055_SYS_ERR_T getSystemError(); BNO055_SYS_ERR_T getSystemError();
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(int gpio, mraa_gpio_edge_t level, jobject runnable)
{
installISR(gpio, level, mraa_java_isr_callback, runnable);
}
#else
/** /**
* install an interrupt handler. * install an interrupt handler.
* *
@ -641,7 +635,6 @@ namespace upm {
*/ */
void installISR(int gpio, mraa_gpio_edge_t level, void installISR(int gpio, mraa_gpio_edge_t level,
void (*isr)(void *), void *arg); void (*isr)(void *), void *arg);
#endif
/** /**
* uninstall a previously installed interrupt handler * uninstall a previously installed interrupt handler
@ -707,10 +700,5 @@ namespace upm {
BNO055(const BNO055&) = delete; BNO055(const BNO055&) = delete;
BNO055 &operator=(const BNO055&) = delete; BNO055 &operator=(const BNO055&) = delete;
// Adding a private function definition for java bindings
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(int gpio, mraa_gpio_edge_t level,
void (*isr)(void *), void *arg);
#endif
}; };
} }

View File

@ -18,19 +18,20 @@
%template(byteVector) std::vector<uint8_t>; %template(byteVector) std::vector<uint8_t>;
%template(intVector) std::vector<int>; %template(intVector) std::vector<int>;
%include "bno055_regs.h"
%include "bno055.hpp"
%{ %{
#include "bno055.hpp" #include "bno055.hpp"
#include "bno055_regs.h"
%} %}
%include "bno055_regs.h"
%include "bno055.hpp"
%pragma(java) jniclasscode=%{ %ignore installISR(int , mraa::Edge , void *, void *);
static {
try { %extend upm::BNO055 {
System.loadLibrary("javaupm_bno055"); void installISR(int gpio, mraa_gpio_edge_t level, jobject runnable)
} catch (UnsatisfiedLinkError e) { {
System.err.println("Native code library failed to load. \n" + e); $self->installISR(gpio, level, mraa_java_isr_callback, runnable);
System.exit(1);
}
} }
%} }
JAVA_JNI_LOADLIBRARY(javaupm_bno055)

View File

@ -59,12 +59,12 @@ int Button::value()
return mraa_gpio_read(m_gpio); return mraa_gpio_read(m_gpio);
} }
#ifdef JAVACALLBACK /*#ifdef JAVACALLBACK
void Button::installISR(mraa::Edge level, jobject runnable) void Button::installISR(mraa::Edge level, jobject runnable)
{ {
installISR(level, mraa_java_isr_callback, runnable); installISR(level, mraa_java_isr_callback, runnable);
} }
#endif #endif*/
void Button::installISR(mraa::Edge level, void (*isr)(void *), void *arg) void Button::installISR(mraa::Edge level, void (*isr)(void *), void *arg)
{ {

View File

@ -87,11 +87,11 @@ class Button{
* @param arg Pointer to an object to be supplied as an * @param arg Pointer to an object to be supplied as an
* argument to the ISR. * argument to the ISR.
*/ */
#if defined(SWIGJAVA) || defined(JAVACALLBACK) /*#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(mraa::Edge level, jobject runnable); void installISR(mraa::Edge level, jobject runnable);
#else #else*/
void installISR(mraa::Edge level, void (*isr)(void *), void *arg); void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
#endif //#endif
/** /**
* Uninstalls the previously installed ISR * Uninstalls the previously installed ISR
* *
@ -99,9 +99,6 @@ class Button{
void uninstallISR(); void uninstallISR();
private: private:
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
#endif
bool m_isrInstalled; bool m_isrInstalled;
std::string m_name; std::string m_name;
mraa_gpio_context m_gpio; mraa_gpio_context m_gpio;

View File

@ -9,13 +9,8 @@
%include "button.hpp" %include "button.hpp"
%pragma(java) jniclasscode=%{ #%ignore
static {
try { JAVA_ADD_INSTALLISR_EDGE(upm::Button)
System.loadLibrary("javaupm_button");
} catch (UnsatisfiedLinkError e) { JAVA_JNI_LOADLIBRARY(javaupm_button)
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -8,13 +8,4 @@
#include "buzzer.hpp" #include "buzzer.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_buzzer)
static {
try {
System.loadLibrary("javaupm_buzzer");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "cjq4435.hpp" %include "cjq4435.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_cjq4435)
static {
try {
System.loadLibrary("javaupm_cjq4435");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "collision.hpp" %include "collision.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_collision)
static {
try {
System.loadLibrary("javaupm_collision");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -30,13 +30,4 @@
%include "curieimu.hpp" %include "curieimu.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_curieimu)
static {
try {
System.loadLibrary("javaupm_curieimu");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
#include "cwlsxxa.hpp" #include "cwlsxxa.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_cwlsxxa)
static {
try {
System.loadLibrary("javaupm_cwlsxxa");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
#include "dfrec.hpp" #include "dfrec.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_dfrec)
static {
try {
System.loadLibrary("javaupm_dfrec");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
#include "dfrorp.hpp" #include "dfrorp.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_dfrorp)
static {
try {
System.loadLibrary("javaupm_dfrorp");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "dfrph.hpp" %include "dfrph.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_dfrph)
static {
try {
System.loadLibrary("javaupm_dfrph");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
%include "ds1307.hpp" %include "ds1307.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ds1307)
static {
try {
System.loadLibrary("javaupm_ds1307");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -18,13 +18,4 @@ import upm_interfaces.*;
%include "ds1808lc.hpp" %include "ds1808lc.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ds1808lc)
static {
try {
System.loadLibrary("javaupm_ds1808lc");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -11,13 +11,4 @@
%array_class(char, charArray); %array_class(char, charArray);
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ds18b20)
static {
try {
System.loadLibrary("javaupm_ds18b20");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -10,13 +10,4 @@
%include "ds2413.hpp" %include "ds2413.hpp"
%array_class(char, charArray); %array_class(char, charArray);
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ds2413)
static {
try {
System.loadLibrary("javaupm_ds2413");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -22,13 +22,4 @@
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_e50hx)
static {
try {
System.loadLibrary("javaupm_e50hx");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -10,13 +10,4 @@
#include "ecezo.hpp" #include "ecezo.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ecezo)
static {
try {
System.loadLibrary("javaupm_ecezo");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "ecs1030.hpp" %include "ecs1030.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ecs1030)
static {
try {
System.loadLibrary("javaupm_ecs1030");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
%include "ehr.hpp" %include "ehr.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_ehr)
static {
try {
System.loadLibrary("javaupm_ehr");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "eldriver.hpp" %include "eldriver.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_eldriver)
static {
try {
System.loadLibrary("javaupm_eldriver");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "electromagnet.hpp" %include "electromagnet.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_electromagnet)
static {
try {
System.loadLibrary("javaupm_electromagnet");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "emg.hpp" %include "emg.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_emg)
static {
try {
System.loadLibrary("javaupm_emg");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "enc03r.hpp" %include "enc03r.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_enc03r)
static {
try {
System.loadLibrary("javaupm_enc03r");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "flex.hpp" %include "flex.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_flex)
static {
try {
System.loadLibrary("javaupm_flex");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -56,13 +56,4 @@
%include "mq9.hpp" %include "mq9.hpp"
%include "tp401.hpp" %include "tp401.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_gas)
static {
try {
System.loadLibrary("javaupm_gas");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "gp2y0a.hpp" %include "gp2y0a.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_gp2y0a)
static {
try {
System.loadLibrary("javaupm_gp2y0a");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -10,13 +10,4 @@
%include "gprs.hpp" %include "gprs.hpp"
%array_class(char, charArray); %array_class(char, charArray);
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_gprs)
static {
try {
System.loadLibrary("javaupm_gprs");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -58,12 +58,12 @@ int GroveButton::value()
return mraa_gpio_read(m_gpio); return mraa_gpio_read(m_gpio);
} }
#ifdef JAVACALLBACK /*#ifdef JAVACALLBACK
void GroveButton::installISR(mraa::Edge level, jobject runnable) void GroveButton::installISR(mraa::Edge level, jobject runnable)
{ {
installISR(level, mraa_java_isr_callback, runnable); installISR(level, mraa_java_isr_callback, runnable);
} }
#endif #endif*/
void GroveButton::installISR(mraa::Edge level, void (*isr)(void *), void *arg) void GroveButton::installISR(mraa::Edge level, void (*isr)(void *), void *arg)
{ {

View File

@ -84,11 +84,11 @@ class GroveButton: public Grove {
* @param arg Pointer to an object to be supplied as an * @param arg Pointer to an object to be supplied as an
* argument to the ISR. * argument to the ISR.
*/ */
#if defined(SWIGJAVA) || defined(JAVACALLBACK) //#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(mraa::Edge level, jobject runnable); // void installISR(mraa::Edge level, jobject runnable);
#else //#else
void installISR(mraa::Edge level, void (*isr)(void *), void *arg); void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
#endif //#endif
/** /**
* Uninstalls the previously installed ISR * Uninstalls the previously installed ISR
* *
@ -96,9 +96,6 @@ class GroveButton: public Grove {
void uninstallISR(); void uninstallISR();
private: private:
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
#endif
bool m_isrInstalled; bool m_isrInstalled;
std::string m_name; std::string m_name;
mraa_gpio_context m_gpio; mraa_gpio_context m_gpio;

View File

@ -49,13 +49,8 @@
#include "grovetemp.hpp" #include "grovetemp.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_ADD_INSTALLISR_EDGE(upm::GroveButton)
static {
try {
System.loadLibrary("javaupm_grove");
} catch (UnsatisfiedLinkError e) { JAVA_JNI_LOADLIBRARY(javaupm_grove)
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "grovecollision.hpp" %include "grovecollision.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovecollision)
static {
try {
System.loadLibrary("javaupm_grovecollision");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
%include "groveehr.hpp" %include "groveehr.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_groveehr)
static {
try {
System.loadLibrary("javaupm_groveehr");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "groveeldriver.hpp" %include "groveeldriver.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_groveeldriver)
static {
try {
System.loadLibrary("javaupm_groveeldriver");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "groveelectromagnet.hpp" %include "groveelectromagnet.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_groveelectromagnet)
static {
try {
System.loadLibrary("javaupm_groveelectromagnet");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "groveemg.hpp" %include "groveemg.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_groveemg)
static {
try {
System.loadLibrary("javaupm_groveemg");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -10,13 +10,4 @@
%include "grovegprs.hpp" %include "grovegprs.hpp"
%array_class(char, charArray); %array_class(char, charArray);
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovegprs)
static {
try {
System.loadLibrary("javaupm_grovegprs");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "grovegsr.hpp" %include "grovegsr.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovegsr)
static {
try {
System.loadLibrary("javaupm_grovegsr");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "grovelinefinder.hpp" %include "grovelinefinder.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovelinefinder)
static {
try {
System.loadLibrary("javaupm_grovelinefinder");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "grovemd.hpp" %include "grovemd.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovemd)
static {
try {
System.loadLibrary("javaupm_grovemd");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "grovemoisture.hpp" %include "grovemoisture.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovemoisture)
static {
try {
System.loadLibrary("javaupm_grovemoisture");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "groveo2.hpp" %include "groveo2.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_groveo2)
static {
try {
System.loadLibrary("javaupm_groveo2");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -8,13 +8,4 @@
%include "grovescam.hpp" %include "grovescam.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovescam)
static {
try {
System.loadLibrary("javaupm_grovescam");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "grovespeaker.hpp" %include "grovespeaker.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovespeaker)
static {
try {
System.loadLibrary("javaupm_grovespeaker");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
%include "groveultrasonic.hpp" %include "groveultrasonic.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_groveultrasonic)
static {
try {
System.loadLibrary("javaupm_groveultrasonic");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "grovevdiv.hpp" %include "grovevdiv.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovevdiv)
static {
try {
System.loadLibrary("javaupm_grovevdiv");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "grovewater.hpp" %include "grovewater.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovewater)
static {
try {
System.loadLibrary("javaupm_grovewater");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
%include "grovewfs.hpp" %include "grovewfs.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_grovewfs)
static {
try {
System.loadLibrary("javaupm_grovewfs");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "gsr.hpp" %include "gsr.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_gsr)
static {
try {
System.loadLibrary("javaupm_gsr");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "guvas12d.hpp" %include "guvas12d.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_guvas12d)
static {
try {
System.loadLibrary("javaupm_guvas12d");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -50,13 +50,4 @@
%include "h3lis331dl.hpp" %include "h3lis331dl.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_h3lis331dl)
static {
try {
System.loadLibrary("javaupm_h3lis331dl");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -8,13 +8,4 @@
%include "h803x.hpp" %include "h803x.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_h803x)
static {
try {
System.loadLibrary("javaupm_h803x");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -8,14 +8,5 @@
%include "hcsr04.h" %include "hcsr04.h"
%include "hcsr04.hpp" %include "hcsr04.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_hcsr04)
static {
try {
System.loadLibrary("javaupm_hcsr04");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -7,13 +7,4 @@
%include "hdc1000.hpp" %include "hdc1000.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_hdc1000)
static {
try {
System.loadLibrary("javaupm_hdc1000");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
%include "hdxxvxta.hpp" %include "hdxxvxta.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_hdxxvxta)
static {
try {
System.loadLibrary("javaupm_hdxxvxta");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -9,13 +9,4 @@
#include "hka5.hpp" #include "hka5.hpp"
%} %}
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_hka5)
static {
try {
System.loadLibrary("javaupm_hka5");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -18,13 +18,4 @@ import upm_interfaces.*;
%include "hlg150h.hpp" %include "hlg150h.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_hlg150h)
static {
try {
System.loadLibrary("javaupm_hlg150h");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -12,13 +12,4 @@
speed_t int_B9600 = B9600; speed_t int_B9600 = B9600;
%array_class(char, charArray); %array_class(char, charArray);
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_hm11)
static {
try {
System.loadLibrary("javaupm_hm11");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -20,13 +20,4 @@
%include "hmc5883l.hpp" %include "hmc5883l.hpp"
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_hmc5883l)
static {
try {
System.loadLibrary("javaupm_hmc5883l");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -25,13 +25,4 @@ READDATA_EXCEPTION(getModSignalStrength())
%include "hmtrp.hpp" %include "hmtrp.hpp"
speed_t int_B9600 = B9600; speed_t int_B9600 = B9600;
%pragma(java) jniclasscode=%{ JAVA_JNI_LOADLIBRARY(javaupm_hmtrp)
static {
try {
System.loadLibrary("javaupm_hmtrp");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

Some files were not shown because too many files have changed in this diff Show More