Private
Public Access
2
0

java: Added Java SWIG binding creation

%init directive is not supported in java so move %init to js/py interface files

Signed-off-by: Alexander Komarov <alexander.komarov@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Alexander Komarov
2015-04-13 13:23:13 +00:00
committed by Brendan Le Foll
parent c5780dceaa
commit 4302f0d0c3
12 changed files with 303 additions and 5 deletions

View File

@@ -68,6 +68,30 @@ typedef enum {
EDGE_FALLING = 3 /**< Interupt on falling only */
} Edge;
#if defined(SWIGJAVA)
class IsrCallback
{
public:
virtual ~IsrCallback()
{
}
virtual void
run()
{ /* empty, overloaded in Java*/
}
private:
};
void
generic_isr_callback(void* data)
{
IsrCallback* callback = (IsrCallback*) data;
callback->run();
}
#endif
/**
* @brief API to General Purpose IO
*
@@ -171,6 +195,12 @@ class Gpio
#endif
return mraa_gpio_isr(m_gpio, (gpio_edge_t) mode, &uvwork, this);
}
#elif defined(SWIGJAVA)
mraa_result_t
isr(Edge mode, IsrCallback* cb, void* args)
{
return mraa_gpio_isr(m_gpio, (gpio_edge_t) mode, generic_isr_callback, cb);
}
#else
/**
* Sets a callback to be called when pin value changes