Private
Public Access
2
0

nodejs: Add isr support to node.js

This commit adds isr support to node.js mraa module, it also forces
SWIGJAVASCRIPT to be set at compile time by cmake (SWIG uses SWIGJAVASCRIPT and
not SWIGNODE in it's preprocessor). This uses libuv uv_queue_work to call v8isr
and is all done at a C++ level unlike the python isr, so this reuses the
mraa_gpio_isr call. This closes #110

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2015-02-18 14:27:50 +00:00
parent ffe40033d4
commit 008184c305
5 changed files with 43 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ if (DOXYGEN_FOUND)
endif ()
set_target_properties (mraajs PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -DBUILDING_NODE_EXTENSION"
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -DBUILDING_NODE_EXTENSION -DSWIGJAVASCRIPT=${SWIG_FOUND}"
PREFIX ""
OUTPUT_NAME mraa
SUFFIX ".node"

View File

@@ -12,7 +12,7 @@
'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
'cflags!': [ '-fno-exceptions' ],
'defines' : [ 'SWIG',
'SWIGNODE',
'SWIGJAVASCRIPT',
'BUILDING_NODE_EXTENSION=1' ],
'conditions' : [
[ 'target_arch=="x64"',

View File

@@ -3,6 +3,7 @@
%feature("autodoc", "3");
%include carrays.i
%include cpointer.i
%array_class(uint8_t, uint8Array);
%inline %{
@@ -19,6 +20,10 @@
$2 = node::Buffer::Length($input);
}
%typemap(in) (v8::Handle<v8::Function> func) {
$1 = v8::Local<v8::Function>::Cast($input);
}
namespace mraa {
class Spi;
%typemap(out) uint8_t*