mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
java: added callback functionality
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com> Signed-off-by: Andrei Vasiliu <andrei.vasiliu@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
3e59323abb
commit
323905a215
@ -4,10 +4,15 @@
|
||||
%include "typemaps.i"
|
||||
%include "arrays_java.i";
|
||||
|
||||
%feature("director") IsrCallback;
|
||||
|
||||
%ignore generic_callback_isr;
|
||||
%include "../IsrCallback.h"
|
||||
|
||||
%apply int {mraa::Edge};
|
||||
%apply float *INOUT { float *x, float *y, float *z };
|
||||
%apply unsigned char[] {uint8_t *buf};
|
||||
|
||||
%include "lsm9ds0.h"
|
||||
%{
|
||||
#include "lsm9ds0.h"
|
||||
%}
|
||||
|
@ -699,6 +699,15 @@ uint8_t LSM9DS0::getInterruptGen2Src()
|
||||
return readReg(DEV_XM, REG_INT_GEN_2_SRC);
|
||||
}
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
void LSM9DS0::installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
|
||||
IsrCallback *cb)
|
||||
{
|
||||
installISR(intr, gpio, level, generic_callback_isr, cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void LSM9DS0::installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
|
||||
void (*isr)(void *), void *arg)
|
||||
{
|
||||
|
@ -25,7 +25,19 @@
|
||||
|
||||
#include <string>
|
||||
#include <mraa/i2c.hpp>
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
#undef SWIGJAVA
|
||||
#include <mraa/gpio.hpp>
|
||||
#define SWIGJAVA
|
||||
#else
|
||||
#include <mraa/gpio.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
#include "../IsrCallback.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define LSM9DS0_I2C_BUS 1
|
||||
#define LSM9DS0_DEFAULT_XM_ADDR 0x1d
|
||||
@ -1382,6 +1394,10 @@ namespace upm {
|
||||
*/
|
||||
uint8_t getInterruptGen2Src();
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
void installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
|
||||
IsrCallback *cb);
|
||||
#else
|
||||
/**
|
||||
* install an interrupt handler.
|
||||
*
|
||||
@ -1396,7 +1412,7 @@ namespace upm {
|
||||
*/
|
||||
void installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
|
||||
void (*isr)(void *), void *arg);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* uninstall a previously installed interrupt handler
|
||||
*
|
||||
@ -1431,6 +1447,11 @@ namespace upm {
|
||||
private:
|
||||
// OR'd with a register, this enables register autoincrement mode,
|
||||
// which we need.
|
||||
#ifdef SWIGJAVA
|
||||
void installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
|
||||
void (*isr)(void *), void *arg);
|
||||
#endif
|
||||
|
||||
static const uint8_t m_autoIncrementMode = 0x80;
|
||||
|
||||
mraa::I2c m_i2cG;
|
||||
|
Reference in New Issue
Block a user